【问题标题】:Finetuning FindBugs ant task in Eclipse在 Eclipse 中微调 FindBugs ant 任务
【发布时间】:2011-03-09 17:46:01
【问题描述】:

在 Eclipse 中,我可以定义要从首选项页面报告的 检测器 ID错误类别

我在 FindBugs docs 中的 FindBugs ant 任务中找不到类似的东西,或者在 Eclipse ant 编辑器中使用自动完成功能。

我可以调整的是努力报告水平

调整检测器和类别是一项未记录或缺失的功能,还是我遗漏了什么?以及在 FindBugs Eclipse 插件中是如何解决的?

【问题讨论】:

    标签: java eclipse ant findbugs


    【解决方案1】:

    我也遇到了一些关于 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>
    

    希望对您有所帮助...

    【讨论】:

    • 是否有机会从“report/YOUR_findbugs_exclude_filter.xml”中获取内容样本?
    • official findbugs manual中有一个很好的例子。
    猜你喜欢
    • 2013-03-01
    • 2012-04-06
    • 2012-09-30
    • 2010-09-22
    • 2010-10-14
    • 2011-01-20
    • 2012-02-04
    • 2013-04-10
    • 1970-01-01
    相关资源
    最近更新 更多