Class PMDTask

  • All Implemented Interfaces:
    Cloneable

    public class PMDTask
    extends org.apache.tools.ant.Task
    PMD Ant task. Setters of this class are interpreted by Ant as properties settable in the XML. This is therefore published API.

    Runs PMD analysis via ant. The ant task looks like this:

    
       <project name="PMDProject" default="main" basedir=".">
         <path id="pmd.classpath">
             <fileset dir="/home/joe/pmd-bin-VERSION/lib">
                 <include name="*.jar"/>
             </fileset>
         </path>
         <taskdef name="pmd" classname="net.sourceforge.pmd.ant.PMDTask" classpathref="pmd.classpath" />
    
         <target name="main">
           <pmd>
             <ruleset>rulesets/java/quickstart.xml</ruleset>
             <ruleset>config/my-ruleset.xml</ruleset>
             <fileset dir="/usr/local/j2sdk1.4.1_01/src/">
                 <include name="java/lang/*.java"/>
             </fileset>
           </pmd>
         </target>
       </project>
     

    Required: rulesetfiles/ruleset, fileset

    • Constructor Detail

      • PMDTask

        public PMDTask()
    • Method Detail

      • execute

        public void execute()
                     throws org.apache.tools.ant.BuildException
        Overrides:
        execute in class org.apache.tools.ant.Task
        Throws:
        org.apache.tools.ant.BuildException
      • setSuppressMarker

        public void setSuppressMarker​(String suppressMarker)
      • setFailOnError

        public void setFailOnError​(boolean fail)
      • setFailOnRuleViolation

        public void setFailOnRuleViolation​(boolean fail)
      • setMaxRuleViolations

        public void setMaxRuleViolations​(int max)
      • setRuleSetFiles

        public void setRuleSetFiles​(String ruleSets)
      • setEncoding

        public void setEncoding​(String sourceEncoding)
      • setThreads

        public void setThreads​(int threads)
      • setFailuresPropertyName

        public void setFailuresPropertyName​(String failuresPropertyName)
      • setMinimumPriority

        public void setMinimumPriority​(int minPriority)
      • addFileset

        public void addFileset​(org.apache.tools.ant.types.FileSet set)
      • addFormatter

        public void addFormatter​(Formatter f)
      • addConfiguredSourceLanguage

        public void addConfiguredSourceLanguage​(SourceLanguage version)
      • setClasspath

        public void setClasspath​(org.apache.tools.ant.types.Path classpath)
      • getClasspath

        public org.apache.tools.ant.types.Path getClasspath()
      • createClasspath

        public org.apache.tools.ant.types.Path createClasspath()
      • setClasspathRef

        public void setClasspathRef​(org.apache.tools.ant.types.Reference r)
      • setAuxClasspath

        public void setAuxClasspath​(org.apache.tools.ant.types.Path auxClasspath)
      • getAuxClasspath

        public org.apache.tools.ant.types.Path getAuxClasspath()
      • createAuxClasspath

        public org.apache.tools.ant.types.Path createAuxClasspath()
      • setAuxClasspathRef

        public void setAuxClasspathRef​(org.apache.tools.ant.types.Reference r)
      • getFilesets

        public List<org.apache.tools.ant.types.FileSet> getFilesets()
      • isFailOnError

        public boolean isFailOnError()
      • isFailOnRuleViolation

        public boolean isFailOnRuleViolation()
      • getSuppressMarker

        public String getSuppressMarker()
      • getRulesetFiles

        public String getRulesetFiles()
      • getEncoding

        public String getEncoding()
      • getThreads

        public int getThreads()
      • getMinimumPriority

        public int getMinimumPriority()
      • getMaxRuleViolations

        public int getMaxRuleViolations()
      • getFailuresPropertyName

        public String getFailuresPropertyName()
      • getCacheLocation

        public String getCacheLocation()
      • setCacheLocation

        public void setCacheLocation​(String cacheLocation)
      • isNoCache

        public boolean isNoCache()
      • setNoCache

        public void setNoCache​(boolean noCache)
      • addRelativizePathsWith

        public void addRelativizePathsWith​(org.apache.tools.ant.types.Path relativizePathsWith)
      • getRelativizePathsWith

        public List<org.apache.tools.ant.types.Path> getRelativizePathsWith()