无法初始化类net.sourceforge.pmd.lang.xpath.Initializer [英] Could not initialize class net.sourceforge.pmd.lang.xpath.Initializer

查看:463
本文介绍了无法初始化类net.sourceforge.pmd.lang.xpath.Initializer的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

下面是我的PMD脚本蚂蚁的build.xml

Here is my pmd script for ant build.xml

<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

Here is a screen shot of my projects explorer, here is a pastebin link to ruleset.xml

这是误差

PMD:

构建失败
  C:\\用户\\迈克尔\\桌面\\ log4jassignment.s06005586 \\的build.xml:112:找不到资源的规则集/ JAVA / basic.xml。确保资源是有效的文件或URL或在CLASSPATH中。下面是当前的classpath:C:\\ Program Files文件\\日食\\插件\\ org.apache.ant_1.8.3.v20120321-1730 \\ LIB \\蚂蚁antlr.jar; C:\\ Program Files文件\\日食\\插件\\ org.apache.ant_1 .8.3.v20120321-1730 \\ LIB \\蚂蚁Apache的bcel.jar; C:\\ Program Files文件\\日食\\插件\\ org.apache.ant_1.8.3.v20120321-1730 \\ LIB \\蚂蚁Apache的bsf.jar;ç :\\ Program Files文件\\日食\\插件\\ org.apache.ant_1.8.3.v20120321-1730 \\ LIB \\蚂蚁Apache的log4j.jar; C:\\ Program Files文件\\日食\\插件\\ org.apache.ant_1.8.3.v20120321 -1730 \\ LIB \\蚂蚁Apache的oro.jar这两个; C:\\ Program Files文件\\日食\\插件\\ org.apache.ant_1.8.3.v20120321-1730 \\ LIB \\蚂蚁Apache的regexp.jar; C:\\ Program Files文件\\日食\\插件\\ org.apache.ant_1.8.3.v20120321-1730 \\ LIB \\蚂蚁Apache的resolver.jar; C:\\ Program Files文件\\日食\\插件\\ org.apache.ant_1.8.3.v20120321-1730 \\ lib中\\蚂蚁Apache的xalan2.jar; C:\\ Program Files文件\\日食\\插件\\ org.apache.ant_1.8.3.v20120321-1730 \\ LIB \\蚂蚁的commons-logging.jar的; C:\\ Program Files文件\\日食\\插件\\ org.apache.ant_1.8.3.v20120321-1730 \\ LIB \\蚂蚁公地net.jar; C:\\ Program Files文件\\日食\\插件\\ org.apache.ant_1.8.3.v20120321-1730 \\ LIB \\蚂蚁宰的.jar; C:\\ Program Files文件\\日食\\插件\\ org.apache.ant_1.8.3.v20120321-1730 \\ LIB \\蚂蚁javamail.jar; C:\\ Program Files文件\\日食\\插件\\ org.apache.ant_1.8.3 .v20120321-1730 \\ LIB \\蚂蚁jdepend.jar; C:\\ Program Files文件\\日食\\插件\\ org.apache.ant_1.8.3.v20120321-1730 \\ LIB \\蚂蚁jmf.jar; C:\\ Program Files文件\\月食\\插件\\ org.apache.ant_1.8.3.v20120321-1730 \\ LIB \\蚂蚁jsch.jar; C:\\ Program Files文件\\日食\\插件\\ org.apache.ant_1.8.3.v20120321-1730 \\ LIB \\蚂蚁的JUnit的.jar; C:\\ Program Files文件\\日食\\插件\\ org.apache.ant_1.8.3.v20120321-1730 \\ LIB \\蚂蚁junit4.jar; C:\\ Program Files文件\\日食\\插件\\ org.apache.ant_1.8.3 .v20120321-1730 \\ LIB \\蚂蚁launcher.jar; C:\\ Program Files文件\\日食\\插件\\ org.apache.ant_1.8.3.v20120321-1730 \\ LIB \\蚂蚁netrexx.jar; C:\\ Program Files文件\\月食\\插件\\ org.apache.ant_1.8.3.v20120321-1730 \\ LIB \\蚂蚁swing.jar; C:\\ Program Files文件\\日食\\插件\\ org.apache.ant_1.8.3.v20120321-1730 \\ LIB \\蚂蚁testutil的.jar; C:\\ Program Files文件\\日食\\插件\\ org.apache.ant_1.8.3.v20120321-1730 \\ lib目录\\的ant.jar; C:\\ Program Files文件\\日食\\配置\\ org.eclipse.osgi \\包\\ 57 \\ 2.cp \\ lib目录\\ antdebug.jar; C:\\ Program Files文件\\日食\\配置\\ org.eclipse.osgi \\包\\ 57 \\ 2.cp \\ lib目录\\ remote.jar; C:\\ Program Files文件\\日食\\配置\\ org.eclipse.osgi \\包\\ 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\\Desktop\\log4jassignment.s06005586\\tools\\jdepend-2.9.1.jar

BUILD FAILED C:\Users\Michael\Desktop\log4jassignment.s06005586\build.xml:112: Can't find resource ruleset/java/basic.xml. Make sure the resource is a valid file or URL or is on the CLASSPATH. Here's the current 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\org.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\Desktop\log4jassignment.s06005586\tools\jdepend-2.9.1.jar

时遇到的主要问题是关于PMD和蚂蚁缺乏信息(它的可怕的没有什么在那里),所以我是pretty在这一点上什么我做错了太多输了...我是pretty肯定我还没有设置我的规则集正确(但没有办法告诉的,因为这缺乏蚂蚁/ PMD实现信息)....

The main problem I'm having is lack of information regarding pmd and ant (its terrible there is nothing out there) so I'm pretty much lost at this point at what I'm doing wrong... I'm pretty sure I havent set up my rulesets correctly (but there isn't a way to tell because of this lack of information for ant/pmd implementations)....

推荐答案

这个错误清楚地说......

The error clearly says...

BUILD FAILED C:\Users\Michael\Desktop\log4jassignment.s06005586\build.xml:112: Can't find resource ruleset/java/basic.xml 

和我没有看到的Java 规则集文件夹里面。因此,获得的文件夹和文件在正确的地方,然后看它是否有效与否

and I don't see java folder inside ruleset. So get the folder and files in right place and then see whether it works or not

这篇关于无法初始化类net.sourceforge.pmd.lang.xpath.Initializer的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆