简体   繁体   中英

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.

Eg 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.

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.

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM