PMD Task For Android

Posted: June 18, 2009 in Android, Java, Mobile
Tags: , , ,

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

Reblog this post [with Zemanta]
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s