Findbugs: UnionBugs Ant Task

When building an ant project with many subprojects, I like to run find bugs on each of them independently. However there isn’t (wasn’t till now) a good way to merge all the bug reports into a single file.

Define the task:

<taskdef name="UnionBugs" classname="edu.umd.cs.findbugs.anttask.UnionBugs">
  <classpath>...</classpath>
</taskdef>

Usage:

<unionbugs to="${testreports.dir}/findbugs.xml">
    <fileset dir="${plugin.basedir}">
  	<include name="**/*_findbugsparts.xml">
    </include>
  </fileset>
</unionbugs>

Download: findbugs-ant-merge.jar

This has been contributed and included in findbugs version 1.3.6-rc3 available at http://findbugs.sourceforge.net/downloads.html