I had some issues with findbugs and ant as well. Here is what I ve done finally:
<taskdef name="findbugs"
classpathref="build_libs"
classname="edu.umd.cs.findbugs.anttask.FindBugsTask" />
<!--
Executes findbugs for a unpacked plugin (folder)
Params:
plugin: the plugin / module to fetch
plugin_dir: the folder to checkout the plugin to
-->
<target name="run.findbugs">
<echo level="info">Running FindBugs: ${plugin}</echo>
<findbugs home="${FINDBUGS.HOME}"
output="xml:withMessages"
outputFile="${report.dir}/findbugs_report_${plugin}.xml"
timeout="1200000"
includefilter="report/YOUR_findbugs_filter.xml"
excludefilter="report/YOUR_findbugs_exclude_filter.xml"
jvmargs="-server -Xss1m -Xmx512m">
<sourcepath location="${plugin_dir}/${plugin}/**/*.java" />
<class location="${install}/plugins/${plugin}_*.jar" />
</findbugs>
</target>
<!--
Executes findbugs for a single eclipse plugin
Params:
plugin: the plugin / module to fetch
plugin_dir: the folder to checkout the plugin to
-->
<target name="run.findbugs.unpacked">
<echo level="info">Running FindBugs: ${plugin} (unpacked)</echo>
<path id="rfu.pfp">
<fileset dir="${install}/plugins/">
<include name="${path_to_jar}" />
</fileset>
</path>
<property name="plugin_fullpath" refid="rfu.pfp" />
<findbugs home="${FINDBUGS.HOME}"
output="xml:withMessages"
outputFile="${report.dir}/findbugs_report_${plugin}.xml"
timeout="1200000"
includefilter="report/YOUR_findbugs_filter.xml"
excludefilter="report/YOUR_findbugs_exclude_filter.xml"
jvmargs="-server -Xss1m -Xmx512m">
<class location="${plugin_fullpath}" />
</findbugs>
</target>
任务:
Unpacked plugin:
<antcall target="run.findbugs.unpacked">
<param name="plugin" value="com.myplugin.core" />
<param name="path_to_jar" value="com.myplugin.core_*/*.jar" />
</antcall>
<>strong>plugin:
<antcall target="run.findbugs">
<param name="plugin" value="com.myplugin.core" />
</antcall>
希望......