I am trying to run PMD
from Ant
in Eclipse
when I build the 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>
It works well for basic.xml
, but I want to run for all rulesets in java
folder (It has around 20 rulesets) So I have 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 folder, not a single file without specifying list of files manually?
For future readers to configure Ant PMD under Eclipse:
- Download
pmd-bin.zip
from official website - Unpack
pmd.jar
,jaxen.jar
andasm.jar
- Add jars above to Window - Preferences - Ant - Runtime - Ant Home Entries - Add External JARs
- Unpack
rulesets
folder - Reference location of ruleset from
<pmd rulesetfiles=...>