繁体   English   中英

使用PMD ant目标时找不到ruleset / basic.xml

[英]Can not find ruleset/basic.xml when using PMD ant target

使用pmd-5.0.1。 我有一些自定义规则集:

<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>

规则集引用了这样的基本规则:

<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"/>

但是,当运行这个蚂蚁目标时,我得到:

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文件的一部分吗? 我错过了什么?

看起来我的规则基于过时的PMD版本。 其中大多数位于rulesets/java/basic.xml/...

暂无
暂无

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

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