Article Index

Example of integrations: Ant, Maven and Eclipse

Ant
<target name="pmd"> 
<taskdef name="pmd" classname="net.sourceforge.pmd.ant.PMDTask"/> 
<pmd shortFilenames="true"> 
<ruleset>rulesets/favorites.xml</ruleset> 
<ruleset>basic</ruleset> 
<formatter type="html" toFile="pmd_report.html&8220;  linkPrefix="http://pmd.sourceforge.net/xref/"/> 
<fileset dir="/tmp/productcatalog/"> 
  <include name=&8220;com/**/*.java"/> 
</fileset> 
</pmd> 
</target>
Maven
<plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-pmd-plugin</artifactId>
        <configuration>
          <linkXref>true</linkXref>
          <sourceEncoding>utf-8</sourceEncoding>
          <!-- 100 tokens corresponds to approximately 5-10 lines of code. -->
          <minimumTokens>100</minimumTokens>
          <targetJdk>1.5</targetJdk>
            <excludes>
            <exclude>**/generated/*.java</exclude>
            </excludes>
        </configuration>
</plugin>
Eclipse

see below

&160;