对不起,我再次奋斗。所以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 =板虫
并收到“问题:无法创建任务或键入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"/>
我想在详细阅读Using the SpotBugs Ant task时你会看到你的
<property name="spotbugs.home" value="C:/ant/lib"/>
不应该指向你复制spotbugs-ant.jar的蚂蚁家,而应该指向一个spotbugs安装本身 - 这与spotbugs ant-task不同。所以spotbugs也必须安装在ant-task旁边。
这也意味着您必须更改类路径
<taskdef resource="edu/umd/cs/findbugs/anttask/tasks.properties" classpath="${spotbugs.home}/spotbugs-ant.jar"/>
指向你应该被复制到你的ant / lib目录的spotbugs-ant.jar。