spotbugs / spotbugs-maven-plugin

Maven Mojo Plug-In to generate reports based on the SpotBugs Analyzer
https://spotbugs.github.io/spotbugs-maven-plugin/
Apache License 2.0
69 stars 51 forks source link

Root-level exclude filter file copied to every module when configured with relativePath #281

Closed pablogalegoc closed 3 years ago

pablogalegoc commented 3 years ago

Description

In multimodule projects that use a exclude filter file at root project level to be consumed by every module, the file is being copied to its equivalent module path when the plugin is configured with <${project.parent.relativePath}>.

How to reproduce

Create a multimodule project with:

Expected result

spotbugs-exclude-filters.xml is copied to target directory of every module.

Actual result

The file is copied to every moduleX/src/main/config/. If the folder doesn't exist, it is created.

Additional details

Since version 4.1.3, seems to be related to #238.

hazendaz commented 3 years ago

I believe #238 removes the drive letter that was showing up in target pulling the entire .m2 cache used in the process. Can you put a simple demo together that shows the issue you are seeing here? I'm not sure I entirely understand your specific issue.

hazendaz commented 3 years ago

Actually a plus would be to add an integration test here that causes the issue so we can make that part of the codebase :)

pablogalegoc commented 3 years ago

Here's an example of the structure and configuration that reproduces the issue I'm seeing: PabloGalegoC/excludefiltersfile-issue-example

If a mvn package is executed, the spotbugs-exclude-filters.xml from src/main/config is copied to module1/src/main/config and module2/src/main/config.

aoterolorenzo commented 3 years ago

Actually a plus would be to add an integration test here that causes the issue so we can make that part of the codebase :)

@hazendaz I took the liberty of submit the integration test triggered by this issue in #282 as you just suggest.

hazendaz commented 3 years ago

Hi @PabloGalegoC @aoterolorenzo I clearly see the issue now. I'm also having trouble seeing the original problem that was intended to be fixed. I need to do a bit more research on older OS tomorrow to see if I can cause the original condition again as I'm trying to understand what exactly its doing there overall and why this occurs. I did confirm this does not occur on version prior to the change.

hazendaz commented 3 years ago

I have reverted the prior fix #238. I adjusted the logic a bit so it handles windows as well which does address #34 original issue with pathing but ultimately this all needs looked at more as it probably shouldn't be copying files around how it is or at least with the add in plugins which is the original issue.