Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Configuring FindBugs in eclipse

I want to use same configuration for FindBugs irrespective of whether it is executed form eclipse or ant build.

Using ant FindBugs task, it is possible to specify which classes FindBugs should analyze. However, FindBugs eclipse plugin has no such option. It considers all classes in the buildpath.

E.g. In case of maven based project the eclipse build path contains both application classes and test classes. I want FindBugs eclipse plugin to not analyze test classes. Is it possible?

Is there a way to customize FindBugs eclipse plugin to indicate classes to analyze?

Thanks in advance.

like image 229
Chir Avatar asked Oct 25 '22 00:10

Chir


2 Answers

It doesn't seem possible, but you could create a second project referencing the same source files (sources only, not tests).

Findbugs would only be active with that second project, for you to inspect the result of a static code analysis.

like image 121
VonC Avatar answered Nov 15 '22 06:11

VonC


You can specify exclusion filter for Java project via preferences -> filter. The filter file is written in xml. See "Filters" chapter in FB manual: http://findbugs.sourceforge.net/manual/filter.html.

Since 2.0.3 one also can re-use Eclipse configuration with ant builds, see the help for "userPreferencesFile" ant option: http://findbugs.sourceforge.net/manual/anttask.html#d0e1339

like image 39
Andrey Loskutov Avatar answered Nov 15 '22 07:11

Andrey Loskutov