Tuesday, July 18, 2006

Findbug Filters with your Maven Findbugs plugin

Do you want to pick the Findbugs bug categories you report?

This is done within your project.properties file. Below is a sample entry from your project.properties file:

maven.findbugs.includeFilter = /Apache/Maven1.0/support/findbugs/includeFilter.xml

This parameter takes a filename of an XML file that contains a definition of the bug(s) to include in the report.

A file could contain the following:

<FindBugsFilter>
<Match classregex="jsp_servlet.*" >
<BugCode name="Nm,DLS" />
</Match>
<Match classregex=".*" >
<BugCode name="Nm" />
</Match>
</FindBugsFilter>



The above tells Findbugs to include Nm and DLS category bugs for all jsp_servlet.* packages and Nm category bugs for the remainder of the code.


maven.findbugs.excludeFilter = /Apache/Maven1.0/support/findbugs/excludeFilter.xml

This parameter takes a filename of an XML file that contains a definition of the bug(s) to exclude in the report.
The file format would be the sames as that for the includeFilter but would state what bugs not to report.


For more information see Chapter 8. Filter Files

Findbug Visitors with your Maven Findbugs plugin

Do you want to pick the Findbugs Detectors you run?

 
 This is done within your project.properties file.  Below is a sample entry from your project.properties file:

maven.findbugs.visitors = FindDeadLocalStores,UnreadFields

The parameters are a comma delimited list of the detector(s) to be run.  Each parameter is the class name without the package name.


maven.findbugs.omitVisitors = FindDeadLocalStores,UnreadFields

The parameters are a comma delimited list of the detector(s) not to be run.  Each parameter is the class name without the package name.

Wednesday, July 05, 2006

Using Custom Findbug Detectors with your Maven Findbugs plugin

Do you wish you could use a new Findbugs Detector you have developed with the Maven-findbugs plug-in?
One example would be using Dave Brosius's fb-contrib Detector plug-in.

This is done within your project.properties file. Below is a sample entry from your project.properties file:

maven.findbugs.plugins = /libs/fb-contrib/fb-contrib-2.2.1.jar

This parameter takes a comma delimited list to the jar file(s) containing the FindBug Detector(s).

For more information on writing your own FindBugs Detector check out FindBugs, Part 2: Writing custom detectors

Monday, July 03, 2006

Update your Findbugs Version in Maven Findbugs plugin

If you wish to use a more recent version of Findbugs with your Maven-findbugs plugin with Maven 1 you can use the jar override functionality of Maven to provide the update. This is done within your project.properties file. Below is a sample:

maven.jar.override=on
maven.findbugs.version=1.0.0
maven.jar.findbugs-ant=${maven.findbugs.version}
maven.jar.coreplugin=${maven.findbugs.version}
maven.jar.findbugs=${maven.findbugs.version}

The first line lets Maven know you would like to override some of the jar locations and/or version. You can read more on this at http://maven.apache.org/maven-1.x/using/managing-dependencies.html.
The second line is merely a variable to make it easier to update your version in one spot in your property file. The last three lines are the jars you wish to override.
The version you pick needs to be available in a repository. The easiest way to browse a Maven repository is with Mevenide's repository browser. It supports both Eclipse and NetBeans.