I've implemented the answer from this question to make it so @Nonnull violations make the build fail. But the problem is, this is finding lots and lots of other bugs that I don't want to deal with yet. I've looked at the manual, and there's no section that jumps out at me as a, "Here's how you configure what to check for" chapter.
To me it seems like it should be in here, but the number of options don't seem nearly comprehensive enough. How would I configure findbugs to only care about the findbugs annotations?
I'll probably accept an answer that tells me how to do it without using the maven plugin because I think I can figure out how to translate that into something the plugin can use.
To generate the FindBugs report as part of the Project Reports, add the FindBugs plugin in the <reporting> section of your pom. xml. Then, execute the site plugin to generate the report.
Here's the findbugs maven configuration I use:
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>findbugs-maven-plugin</artifactId>
<version>2.4.0</version>
<configuration>
<excludeFilterFile>findbugs-exclude.xml</excludeFilterFile>
<findbugsXmlOutput>true</findbugsXmlOutput>
<xmlOutput>true</xmlOutput>
</configuration>
</plugin>
The findbugs-exclude.xml file is in my project root directory (same level as pom.xml - I should probably put it somewhere better), and it configures what findbugs issues I want to ignore. Here's what's in my exclude file:
<?xml version="1.0" encoding="UTF-8"?>
<FindBugsFilter>
<Match>
<Bug pattern="EI_EXPOSE_REP,EI_EXPOSE_REP2"/>
</Match>
<Match>
<Package name="com.mypackage.something"/>
</Match>
</FindBugsFilter>
There's more info about configuring the findbugs filter files in the findbugs manual
Also nore that you could change the findbugs maven plugin to only include certain filters using this instead of excludeFilterFile
:
<includeFilterFile>findbugs-include.xml</includeFilterFile>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With