Within eclipse I am able to define detector ids and bug categories to be reported from the preference page.
I can't find anything like that for the FindBugs ant task in the FindBugs docs or using autocomplete inside the Eclipse ant editor.
The things I can adjust are the effort and the report level.
Is adjusting the detectors and categories an undocumented or a missing feature or have I missed something? And how is it solved in the FindBugs Eclipse plugin?
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>
Call the task:
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>
plugin:
<antcall target="run.findbugs">
<param name="plugin" value="com.myplugin.core" />
</antcall>
Hope that helps...
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With