Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/ant/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java 在构建xml(ant)中包含spotbugs目标_Java_Ant_Build.xml_Spotbugs - Fatal编程技术网

Java 在构建xml(ant)中包含spotbugs目标

Java 在构建xml(ant)中包含spotbugs目标,java,ant,build.xml,spotbugs,Java,Ant,Build.xml,Spotbugs,对不起,我又挣扎了。因此taskdef工作正常,但我无法实际处理Spotbug <target name="bugs" depends="compile"> <spotbugs home="${spotbugs.home}" output="${spotbugs.output}" outputFile="bugs.${spotbugs.output}" excludeFilter="${spotbugs.exclude}

对不起,我又挣扎了。因此taskdef工作正常,但我无法实际处理Spotbug

<target name="bugs" depends="compile">

    <spotbugs home="${spotbugs.home}"
        output="${spotbugs.output}"
        outputFile="bugs.${spotbugs.output}"
        excludeFilter="${spotbugs.exclude}">
    <sourcePath path="."/>
    <auxClassPath path="."/>
    <fileset dir="." includes="${package}/*.class"/>
</spotbugs>

所以我想用

ant-Dpackage=einstieg bug

并收到“问题:未能创建任务或键入spotbugs”。我在checkstyle中使用的相同模式非常有效。taskdefinition指向spotbugs和所需的类,没有任何错误。有什么建议吗

所以我认为斑点虫根本不存在。但是/lib目录中存在合适的文件

以下是Taskdefinition的外观:

<!-- spotbugs settings -->
    <property name="spotbugs.home" value="C:/ant/lib"/>
    <property name="spotbugs.output" value="xml"/>
    <property name="spotbugs.exclude"
              value="C:/Users/wolfbiker/Documents/einstieg/exclude_filter.xml"/>
    <taskdef resource="edu/umd/cs/findbugs/anttask/tasks.properties"
             classpath="${spotbugs.home}/spotbugs-ant.jar"/>

我想当你详细阅读时,你会发现

<property name="spotbugs.home" value="C:/ant/lib"/>

不应指向您复制spotbug ant.jar的ant主页,而应指向spotbug安装本身,这与spotbug ant任务不同。 因此,spotbugs也必须安装在ant任务旁边

这也意味着您必须更改类路径

<taskdef resource="edu/umd/cs/findbugs/anttask/tasks.properties" classpath="${spotbugs.home}/spotbugs-ant.jar"/>


指向spotbugs-ant.jar,您应该已经被复制到您的ant/lib目录中。

现在大多数开发人员都使用maven或gradle,您是否被固定到ant?您是否已经阅读并遵循:嘿,是的,所以我的教授希望我们使用所有ant任务。已经阅读了手册,但可能需要更多的时间来理解所有内容。。非常感谢你的帮助。实际上,我没有将SpotBugs文件安装到单独的目录中。我修复了这个问题,还编辑了build.xml文件。可能仍然有一些错误,因为我仍然收到相同的错误消息。好好想想,也许又犯了一个明显的错误:X