Question

I've been reading all over the PMD Website and it has all these references to <rule ref="rulesets/basic.xml/UnnecessaryConversionTemporary"/> but I cant find the file basic.xml in either the pmd-bin-5.0.0 or pmd-bin-5.0-alpha directory downloaded from sourceforge.

As you can see in the screen dump I've provided below, I've done a search for this basic.xml and came up empty handed.

Basic XML
(source: iforce.co.nz)

In the next screen shot of pmd-bin-5.0.0 there is no folder called ruleset

pmd directory
(source: iforce.co.nz)

Pastebin link to ruleset.xml (Expires in 24 hours)

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

When my ant script is executed it comes back with this error

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

Project Explorer

project
(source: iforce.co.nz)

So that tells me that the basic.xml file doesn't come from the pmd-5.0.0.jar file but in fact comes from somewhere else, Thus my question is what is the contents of pmd's basic.xml, and other required xml files (how am I meant to get my hands on them)? or do these files not exist and am I meant to recreate them myself (and if I am, how would I go about doing this?)?

Était-ce utile?

La solution

I downloaded pmd-bin-5.0-alpha.zip from PMD Website.

Once you unzip pmd-bin-5.0-alpha.zip file; go inside the lib directory and try to extract the content of pmd-5.0-alpha.jar.

I was able to find the following:

basic.xml

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top