这是我的ant build.xml的pmd脚本
<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"/>
<exclude name="/rulesets" />
</fileset>
</path>
<target name="pmd" depends="compile" >
<taskdef name="pmd" classname="net.sourceforge.pmd.ant.PMDTask" classpathref="pmd.lib"/>
<pmd shortFilenames="true">
<ruleset>b</ruleset>
<formatter type="text" toFile="pmd-ant-results.txt"/>
<fileset dir="src">
<include name="**/*.java"/>
</fileset>
</pmd>
</target>
以下是我的项目资源管理器的屏幕截图,这是一个指向ruleset.xml
的pastebin链接projects http://iforce.co.nz/i/zmystq0w.2q2.png
这是错误
PMD:
建立失败 C:\ Users \ Michael \ Desktop \ log4jassignment.s06005586 \ build.xml:112:找不到资源规则集/ java / basic.xml。确保资源是有效的文件或URL,或者位于CLASSPATH上。这是当前的类路径:C:\ Program Files \ eclipse \ plugins \ org.apache.ant_1.8.3.v20120321-1730 \ lib \ ant-antlr.jar; C:\ Program Files \ eclipse \ plugins \ org.apache.ant_1 .8.3.v20120321-1730 \ lib \ ant-apache-bcel.jar; C:\ Program Files \ eclipse \ plugins \ org.apache.ant_1.8.3.v20120321-1730 \ lib \ ant-apache-bsf.jar; C :\ Program Files \ eclipse \ plugins \ org.apache.ant_1.8.3.v20120321-1730 \ lib \ ant-apache-log4j.jar; C:\ Program Files \ eclipse \ plugins \ org.apache.ant_1.8.3.v20120321 -1730 \ lib \ ant-apache-oro.jar; C:\ Program Files \ eclipse \ plugins \ org.apache.ant_1.8.3.v20120321-1730 \ lib \ ant-apache-regexp.jar; C:\ Program Files \ eclipse \ plugins \ org.apache.ant_1.8.3.v20120321-1730 \ lib \ ant-apache-resolver.jar; C:\ Program Files \ eclipse \ plugins \ org.apache.ant_1.8.3.v20120321-1730 \ lib \ ant-apache-xalan2.jar; C:\ Program Files \ eclipse \ plugins \ org.apache.ant_1.8.3.v20120321-1730 \ lib \ ant-commons-logging.jar; C:\ Program Files \ eclipse \ plugins \ org.apache.ant_1.8.3.v20120321-1730 \ lib \ ant-commons-net.jar; C:\ Program Files \ eclipse \ plugins \或g.apache.ant_1.8.3.v20120321-1730 \ lib \ ant-jai.jar; C:\ Program Files \ eclipse \ plugins \ org.apache.ant_1.8.3.v20120321-1730 \ lib \ ant-javamail.jar; C:\ Program Files \ eclipse \ plugins \ org.apache.ant_1.8.3.v20120321-1730 \ lib \ ant-jdepend.jar; C:\ Program Files \ eclipse \ plugins \ org.apache.ant_1.8.3.v20120321- 1730 \ lib \ ant-jmf.jar; C:\ Program Files \ eclipse \ plugins \ org.apache.ant_1.8.3.v20120321-1730 \ lib \ ant-jsch.jar; C:\ Program Files \ eclipse \ plugins \ org.apache.ant_1.8.3.v20120321-1730 \ lib \ ant-junit.jar; C:\ Program Files \ eclipse \ plugins \ org.apache.ant_1.8.3.v20120321-1730 \ lib \ ant-junit4.jar; C:\ Program Files \ eclipse \ plugins \ org.apache.ant_1.8.3.v20120321-1730 \ lib \ ant-launcher.jar; C:\ Program Files \ eclipse \ plugins \ org.apache.ant_1.8.3.v20120321- 1730 \ lib \ ant-netrexx.jar; C:\ Program Files \ eclipse \ plugins \ org.apache.ant_1.8.3.v20120321-1730 \ lib \ ant-swing.jar; C:\ Program Files \ eclipse \ plugins \ org.apache.ant_1.8.3.v20120321-1730 \ lib \ ant-testutil.jar; C:\ Program Files \ eclipse \ plugins \ org.apache.ant_1.8.3.v20120321-1730 \ lib \ ant.jar; C:\ Program Files \ eclipse \ configuration \ org.eclipse.osgi \ bundles \ 57 \ 2.cp \ lib \ antdebug.jar; C:\ Program Files \ eclipse \ configuration \ org.eclipse。 osgi \ bundles \ 57 \ 2.cp \ lib \ remote.jar; C:\ Program Files \ eclipse \ configuration \ org.eclipse.osgi \ bundles \ 58 \ 2.cp \ lib \ remoteAnt.jar; C:\ Program Files \ Java \ jdk1.6.0_25 \ lib \ tools.jar; C:\ Program Files \ eclipse \ plugins \ org.eclipse.swt.win32.win32.x86_64_3.100.0.v4233d.jar; C:\ Users \ Michael \桌面\ log4jassignment.s06005586 \工具\ jdepend-2.9.1.jar
我遇到的主要问题是缺乏有关pmd和蚂蚁的信息(可怕的是那里什么都没有)所以我在这方面几乎失去了我做错的事......我是我确实没有正确设置我的规则集(但由于缺少ant / pmd实现的信息,因此无法判断出来)....
答案 0 :(得分:1)
错误明确表示......
BUILD FAILED C:\Users\Michael\Desktop\log4jassignment.s06005586\build.xml:112: Can't find resource ruleset/java/basic.xml
我在java
内看不到ruleset
个文件夹。因此,将文件夹和文件放在正确的位置,然后查看它是否有效