PMD Task For Android
I do not think any of us are Apache ANT experts, but here is the PMD task that I am using with an Android setup:
<pmd >
<ruleset>rulesets/andcooper.xml</ruleset>
<formatter type="xml" toFile="${inreports-folder}/${project.name}.${DSTAMP}.${TSTAMP}.pmd.xml"/>
<auxclasspath>
<pathelement location="${android-jar}"/>
<fileset dir="${project.home}/libs">
<include name="*.jar" />
</fileset>
</auxclasspath>
<classpath refid="reporttools.classpath" />
<fileset dir="${source-location}" includes="**/*.java" />
</pmd>
<xslt basedir="${inreports-folder}" destdir="${outreports-folder}"
includes="${project.name}.${DSTAMP}.${TSTAMP}.pmd.xml"
style="${pmd.home}/andcooper.pmd.xsl">
<param name="rulesets" expression="${rulesets}"/>
<param name="project" expression="${project}"/>
<param name="today" expression="${today}"/>
</xslt>
Of course you will have to define your own ANT properties. It is assumed that the PMD ruleset is in the PMD.jar and thus you will include again with classpath refid
so that the PMD task can find the ruleset. Also notice to use the PMD xslt provided stylesheet you should provide two xslt parameters to the xslt task
No comments yet.
![Reblog this post [with Zemanta]](http://img.zemanta.com/reblog_e.png?x-id=5cea9009-ad58-4b94-9601-dcdf554c79f3)


