title: How to run all rulesets from a folder using PMD Ant in Eclipse?
body: <p>I am trying to run <code>PMD</code> from <code>Ant</code> in <code>Eclipse</code> when I build the project.</p>
  
  <p>This is my build.xml file:</p>
  
  <pre><code>&lt;taskdef name="pmd" classname="net.sourceforge.pmd.ant.PMDTask"/&gt;
  
  &lt;target name="check_pmd"&gt;
      &lt;pmd rulesetfiles="C:\Users\Nikolay\ProjectName\lib\rulesets\java\basic.xml"&gt;
          &lt;formatter type="html" toFile="pmd_report.html" toConsole="true"/&gt;
          &lt;fileset dir="C:\Users\Nikolay\ProjectName\src"&gt;
              &lt;include name="**/*.java"/&gt;
          &lt;/fileset&gt;
      &lt;/pmd&gt;
  &lt;/target&gt;
  </code></pre>
  
  <p>It works well for <code>basic.xml</code>, but I want to run for all rulesets in <code>java</code> folder (It has around 20 rulesets) So I have tried:</p>
  
  <pre><code>&lt;pmd rulesetfiles="C:\Users\Nikolay\ProjectName\lib\rulesets\java\*.xml"&gt;
  &lt;pmd rulesetfiles="C:\Users\Nikolay\ProjectName\lib\rulesets\java\*"&gt;
  </code></pre>
  
  <p>But both of them fail when I try to run. <strong>Is there a way to specify folder, not a single file without specifying list of files manually?</strong> </p>
  
  <p><strong>For future readers to configure Ant PMD under Eclipse:</strong></p>
  
  <ul>
  <li>Download <code>pmd-bin.zip</code> from official website</li>
  <li>Unpack <code>pmd.jar</code>, <code>jaxen.jar</code> and <code>asm.jar</code></li>
  <li>Add jars above to Window - Preferences - Ant - Runtime - Ant Home Entries - Add External JARs</li>
  <li>Unpack <code>rulesets</code> folder </li>
  <li>Reference location of ruleset from <code>&lt;pmd rulesetfiles=...&gt;</code></li>
  </ul>