我一直在阅读整个PMD 网站,它包含所有这些引用, <rule ref="rulesets/basic.xml/UnnecessaryConversionTemporary"/>
但我无法在从sourceforgebasic.xml
下载的pmd-bin-5.0.0
or pmd-bin-5.0-alpha
目录中找到该文件。
正如您在下面提供的屏幕转储中看到的那样,我已经对此进行了搜索,但basic.xml
空手而归。
(来源:iforce.co.nz)
在下一个屏幕截图中pmd-bin-5.0.0
,没有名为ruleset的文件夹
(来源:iforce.co.nz)
Pastebin链接到 ruleset.xml (24 小时后过期)
<property name="pmd.dir" value="${basedir}/pmd" /><!-- directory that contains pmd.jar -->
<property name="pmd.test.results" location="${build.dir}/pmd"/>
<path id="pmd.lib" >
<fileset dir="${pmd.dir}">
<include name="*.jar"/>
</fileset>
</path>
<target name="pmd" depends="compile" >
<taskdef name="pmd" classname="net.sourceforge.pmd.ant.PMDTask" classpathref="pmd.lib"/>
<pmd shortFilenames="true">
<ruleset>basic,imports</ruleset>
<formatter type="text" toFile="pmd-ant-results.txt"/>
<fileset dir="src">
<include name="**/*.java"/>
</fileset>
</pmd>
</target>
执行我的 ant 脚本时,它会返回此错误
[pmd] net.sourceforge.pmd.RuleSetNotFoundException: Can't find resource rulesets/basic.xml. Make sure the resource is a valid file or URL or is on the CLASSPATH.
BUILD FAILED
C:\Users\Michael\Desktop\log4jassignment.s06005586\build.xml:131: 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.
项目浏览器
(来源:iforce.co.nz)
所以这告诉我该basic.xml
文件不是来自该pmd-5.0.0.jar
文件,而是实际上来自其他地方,因此我的问题是 pmd'sbasic.xml
和其他必需的 xml 文件的内容是什么(我打算如何处理它们) ? 还是这些文件不存在,我是否打算自己重新创建它们(如果是,我将如何去做?)?