35210

Could not initialize class net.sourceforge.pmd.lang.xpath.Initializer

Question:

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>

Here is a screen shot of my projects explorer, here is a pastebin link to <a href="http://pastebin.com/raw.php?i=DGuHzxg3" rel="nofollow">ruleset.xml</a>

<a href="http://iforce.co.nz/i/zmystq0w.2q2.png" rel="nofollow">projects http://iforce.co.nz/i/zmystq0w.2q2.png</a>

And here is the error

<blockquote>

pmd:

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

</blockquote>

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

Answer1:

The error clearly says...

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

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

Recommend

  • How can I get JUnit test (driven from Ant script) to dump the stack of exception that causes failure
  • By java how to count file numbers in a directory without list()
  • Database extension is accdb when I want it to be mdb
  • show google maps in android v2 app crashes on open activity, inflate exception binary file number #2
  • Some clarification about how ant copy some files into a folder?
  • Why is Phing running my build.xml, and then saying it doesn't exist?
  • Put elements of a 1D vector into a 3D matrix using another matrix of positions
  • PHP Fatal error: Class 'Controllercommon' not found in C:\\Inetpub\\Low Vision - Phili
  • Twitter json API foreign characters
  • mapping joda timezone to windows timezone (for example in C#)
  • Using BOOST_FOREACH with a constant intrusive list
  • Error 3251 on .oldValue control property
  • Append element to binary file
  • Can we overload malloc()?
  • Simple script doesn't show anything on the Output in LuaEdit
  • Git subtree post hook
  • Unable to run app-client that is accessing an EJB on GlassFish v3
  • Files in gitignore
  • Where to get the .java files of a netbeans project?
  • How to create MSBuild targets file to deploy files?
  • Objective C - Create a framework for my iphone apps?
  • Install different versions of nuget packages inside one solution file with two projects
  • How to remove left and right margins from all wrapped rows in flexbox (without nth-child or js)
  • Unable to run SDL program in Eclipse but able to do so in Windows Explorer
  • How to format code on aptana 3?
  • Using Netbeans with Cygwin and SDL, including SDL.h creates strange error
  • Does Apportable support to build library binary (.a/.so)?
  • Redux Form - Not able to type anything in input
  • Problem while Building a Setup Project for a windows Service?
  • Webgrid not refreshing after delete MVC
  • Do I need to reset a Perl hash index?
  • Jquery UI tool tip close icon
  • Sony Xperia Z Tablet not found by adb
  • VS2008 Enable C++ Exception with SEH
  • Why winpcap requires both .lib and .dll to run?
  • Traverse Array and Display in markup
  • How to get icons for entities from eclipse?
  • Turn off referential integrity in Derby? is it possible?
  • Qt: Run a script BEFORE make
  • JaxB to read class hierarchy