Android in Hudson (4) 加入PMD分析
PMD其實也跟Android預設的行為沒有關係,因此只要按照其官方文件的寫法加入project的build.xml中即可
<!-- PMD -->
<property name="pmd.home" value="path to your PMD" />
<path id="pmd_lib">
<pathelement location="${pmd.home}/lib/asm-3.1.jar"/>
<pathelement location="${pmd.home}/lib/jaxen-1.1.1.jar"/>
<pathelement location="${pmd.home}/lib/junit-4.4.jar"/>
<pathelement location="${pmd.home}/lib/pmd-4.2.5.jar"/>
</path>
<taskdef name="pmd" classname="net.sourceforge.pmd.ant.PMDTask" classpathref="pmd_lib"/>
<target name="pmd">
<pmd shortFilenames="true">
<ruleset>rulesets/favorites.xml</ruleset>
<ruleset>basic</ruleset>
<formatter type="xml" toFile="pmd.xml"/>
<fileset dir="src">
<include name="**/*.java"/>
</fileset>
</pmd>
</target>
參考文件:http://pmd.sourceforge.net/ant-task.html
注意:target定義需在<setup />後,taskdef與property等需在<setup />前