在eclipse中,我可以定义从首选项页面报告的检测器ID 和错误类别。
我在FindBugs docs中找不到类似于FindBugs ant任务的内容,或者在Eclipse ant编辑器中使用自动完成功能。
我可以调整的是努力和报告级别。
将探测器和类别调整为无证或缺失的功能还是我错过了什么?它是如何在FindBugs Eclipse插件中解决的?
答案 0 :(得分:9)
我也遇到过findbugs和ant的问题。这是我最后做的:
<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>
调用任务:
解压后的插件:
<antcall target="run.findbugs.unpacked">
<param name="plugin" value="com.myplugin.core" />
<param name="path_to_jar" value="com.myplugin.core_*/*.jar" />
</antcall>
<强>插件:强>
<antcall target="run.findbugs">
<param name="plugin" value="com.myplugin.core" />
</antcall>
希望有帮助...