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