I am trying to run PMDfrom Antin Eclipsewhile creating a project.
This is my build.xml file:
<taskdef name="pmd" classname="net.sourceforge.pmd.ant.PMDTask"/>
<target name="check_pmd">
<pmd rulesetfiles="C:\Users\Nikolay\ProjectName\lib\rulesets\java\basic.xml">
<formatter type="html" toFile="pmd_report.html" toConsole="true"/>
<fileset dir="C:\Users\Nikolay\ProjectName\src">
<include name="**/*.java"/>
</fileset>
</pmd>
</target>
This works well for basic.xml, but I want to run for all rule sets in a folder java(it has about 20 rule sets). So I tried:
<pmd rulesetfiles="C:\Users\Nikolay\ProjectName\lib\rulesets\java\*.xml">
<pmd rulesetfiles="C:\Users\Nikolay\ProjectName\lib\rulesets\java\*">
But both of them fail when I try to run. Is there a way to specify a folder rather than a single file without specifying a list of files manually?
For future readers to configure Ant PMD in Eclipse:
- Download
pmd-bin.zipfrom the official site - Unpack
pmd.jar, jaxen.jarandasm.jar - Add Banks Above to Window - Preferences - Ant - Runtime - Ant Home Records - Add External JARs
- unzip folder
rulesets - Link to a set of rules from
<pmd rulesetfiles=...>