Here is what I am doing in my current project, it puts findbugs-exclude.xml
in the parent project (which I know you don't want), but it fixes the DRY problem of maintaining it in two places. It is simpler than unpacking, but requires that the full project structure be local. (I think the unpacking solution would be useful to use the same config across many projects, as in a corporate environment.)
I store my findbugs config in parent/src/main/resources/shared/findbugs-exclude.xml
, but as long as it is in parent the specific directory doesn't matter.
I then use properties to describe the location of the 'shared' directory:
<properties>
<myproject.parent.basedir>${project.parent.basedir}</myproject.parent.basedir>
<myproject.parent.shared.resources>${myproject.parent.basedir}/src/main/resources/shared</myproject.parent.shared.resources>
</properties>
And reference these properties when configuring findbugs in the parent:
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>findbugs-maven-plugin</artifactId>
<configuration>
<excludeFilterFile>${myproject.parent.shared.resources}/findbugs-exclude.xml</excludeFilterFile>
</configuration>
...
</plugin>
All direct child projects will now run findbugs, referencing the config file in parent. If you have multiple levels of project nesting, you will have to override the myproject.parent.basedir
in the sub-parent. For example if you have parent <- sub-parent <- child, you would put :
<properties>
<myproject.parent.basedir>${project.parent.parent.basedir}</myproject.parent.basedir>
</properties>