Findbugs exclude generated files

I am trying to filter out the generated files from the findbugs check, and everything I tried does not seem to work. Pretty much part of my build process. I create many classes that fall into a folder called src / generated. I would be interested in filtering out all these classes. I am using maven, but I do not think it matters.

Thanks in advance.

+7
source share
2 answers

Not knowing what you tried, it's a little problematic to help.

Here is a snippet that we use to skip several error patterns that are present in the code created by Avro.

<FindBugsFilter> <Match> <!-- Avro generates redundant "implements" interface declarations --> <Or> <Package name="~com[.]foo[.]plugh[.]avro([.].*)?" /> <Package name="~com[.]foo[.]xyzzy[.]protocol([.].*)?" /> </Or> <Or> <Bug pattern="RI_REDUNDANT_INTERFACES" /> <Bug pattern="NM_CLASS_NAMING_CONVENTION" /> <Bug pattern="REC_CATCH_EXCEPTION" /> </Or> </Match> <FindBugsFilter> 
+2
source

Here's how to use Codehaus findbugs-maven-plugin. You include packages that you want to parse, rather than excluding those that you do not.

 <reporting> <plugins> <plugin> <groupId>org.codehaus.mojo</groupId> <artifactId>findbugs-maven-plugin</artifactId> <version>2.5.2</version> <configuration> <onlyAnalyze>com.company.util.*,com.company.myapp.*</onlyAnalyze> </configuration> </plugin> </plugins> </reporting> 
0
source

All Articles