After spending a day on creating the filter files manually, I found it to be a bit fiddly and time-consuming to create these by hand. I tried looking to see if there was a way to automate this a bit more. I might be wrong, but I could not find a tool to do this. Hopefully the below will help others in the same situation.
When you run a findbugs check it generates an output file. I do this via the maven plugin:
mvn findbugs:checkwhich yields a file called
findbugsCheck.xml. This file references an xsl stylesheet:
<?xml-stylesheet type="text/xsl" href="http://findbugs.sourceforge.net/xsl/default.xsl"?>
so if you open this file in your browser you will see something like this:
I created another version of default.xsl called filterHelper.xsl. Modifying findbugsCheck.xml to use this stylesheet:
<?xml-stylesheet type="text/xsl" href="http://anonsvn.jboss.org/repos/jbossas/projects/findbugs-filtercreator/trunk/filterHelper.xsl"?>
gives output that looks much the same
Now each bug has a a checkbox next to it. Check the bugs you want to create an exclude filter for, press the "Create Filter" button and the textarea gets populated with the
Matchelements for each bug.
You can then copy the results into a file, in my projects they are under
src/main/resources/findbugs/exclude.xml. For example:
<!-- Rest of exclusions here -->
Then set maven up to use the filter in the plugins section: