简体   繁体   English

在Eclipse中Finetuning FindBugs ant任务

[英]Finetuning FindBugs ant task in Eclipse

Within eclipse I am able to define detector ids and bug categories to be reported from the preference page. 在eclipse中,我能够定义从首选项页面报告的检测器ID错误类别

I can't find anything like that for the FindBugs ant task in the FindBugs docs or using autocomplete inside the Eclipse ant editor. 我在FindBugs文档中找不到类似FindBugs ant任务的东西,或者在Eclipse ant编辑器中使用自动完成。

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? 它是如何在FindBugs Eclipse插件中解决的?

I had some issues with findbugs and ant as well. 我和findbugs和ant也有一些问题。 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... 希望有帮助......

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM