This is an example of PMD ANT script.
<?xml version="1.0" encoding="UTF-8"?>
<!-- Description :This ANT script execute PMD.-->
<project default="pmd.script" name="Sample PMD script.">
<!-- Default target -->
<target name="pmd.run" depends="pmd.cit"/>
<!-- Properties -->
<property name="checkout.project.dir" value="C:/Program Files (x86)/Jenkins/jobs"/>
<property name="pmd.home" value="C:/pmd-bin-5.0.0"/>
<property name="pmd.reports.dir" value="C:/reports"/>
<property name="pmd.rulesets" value="java-basic,java-optimizations,java-strings"/>
<path id="PMD.lib">
<fileset dir="${pmd.home}/lib">
<include name="*.jar" />
</fileset>
</path>
<taskdef name="pmd" classname="net.sourceforge.pmd.ant.PMDTask" >
<classpath refid="PMD.lib" />
</taskdef>
<target name="pmd.cit">
<tstamp>
<format property="init_time" pattern="yyyy.MMM.dd ':' HH:mm:ss z" locale="en"/>
<format property="ext_time" pattern="yyyyMMMddHHmmss" locale="en"/>
</tstamp>
<move failonerror="false" file="${pmd.reports.dir}/pmd.html" tofile="${pmd.reports.dir}/archives/pmd_${ext_time}.html"/>
<pmd rulesetfiles="${pmd.rulesets}">
<formatter type="html" toFile="${pmd.reports.dir}/pmd.html" toConsole="true"/>
<fileset dir="${checkout.project.dir}/workspace/src/">
<include name="**/*.java"/>
</fileset>
</pmd>
</target>
</project>
No comments:
Post a Comment