使用PMD Ant目标的时候找不到规则集/ basic.xml [英] Can not find ruleset/basic.xml when using PMD ant target
本文介绍了使用PMD Ant目标的时候找不到规则集/ basic.xml的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
使用PMD-5.0.1。我有一些自定义的规则集:
Using pmd-5.0.1. I have some custom rulesets:
<target name="pmd">
<condition property="rules.file" else="${data}\pmdrules.xml,${data}\madcustompmdrules.xml">
<isset property="rules.file"/>
</condition>
<pmd rulesetfiles="${rules.file}">
<formatter type="xml" toFile="${report.file}"/>
<fileset dir="${src}">
<include name="**/*.java"/>
</fileset>
</pmd>
</target>
该规则集引用基本规则是这样的:
The rulesets reference basic rules like this:
<rule ref="rulesets/basic.xml/EmptySwitchStatements"/>
<rule ref="rulesets/basic.xml/JumbledIncrementer"/>
<rule ref="rulesets/basic.xml/ForLoopShouldBeWhileLoop"/>
<rule ref="rulesets/basic.xml/UnnecessaryConversionTemporary"/>
<rule ref="rulesets/basic.xml/OverrideBothEqualsAndHashcode"/>
<rule ref="rulesets/basic.xml/DoubleCheckedLocking"/>
然而,运行此ant目标时,我得到:
However, when running this ant target I get:
java.lang.RuntimeException: Couldn't find the class Can't find resource rulesets/basic.xml. Make sure the resource is a valid file or URL or is on the CLASSPATH.
应该不是basic.xml是jar文件的一部分?我缺少什么?
Shouldn't basic.xml be part of the jar file? What am I missing?
推荐答案
看起来像我在我的基础规则关闭PMD过时的版本。他们中的大多数都位于规则集/ JAVA / basic.xml /...
。
Looks like I was basing my rules off an outdated version of PMD. Most of them are located at rulesets/java/basic.xml/...
.
这篇关于使用PMD Ant目标的时候找不到规则集/ basic.xml的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文