Using PMD with Hudson Integration Environment Part 3
PMD is a static analysis tool and can be used with Hudson. To use it with Hudson, you should follow these steps:
1)Download PMD at http://sourceforge.net/projects/pmd/
2)You should set a environmental variable called PMD_HOME in Windows and in Hudson. Do not forget to set it in Hudson or it won't work.
3)Select PMD from the Plugin list in Manage Plugins and install it.
4) To display PMD information, you should open the config section under the project and select Publish PMD. You should put the name of the file that you have as your output in the text box. Make sure this name matches your output you put in your build script.
5) You should add this to your build.xml file:
<taskdef name="pmd" classname="net.sourceforge.pmd.ant.PMDTask">
<classpath><pathelement location="${env.PMD_HOME}/lib/pmd-4.2.5.jar"/></classpath>
</taskdef>
and add this as a target to run your PMD:
<target name="pmd" depends="findbugs">
<pmd shortFilenames="true">
<ruleset>delegata_pmd_ruleset_standard.xml</ruleset>
<formatter type="html" toFile="pmd_report.html" linkPrefix="http://pmd.sourceforge.net/xref/"/>
<formatter type="xml" toFile="pmd.xml"/>
<fileset dir="/Hudson/jobs/ProjectName/workspace/src/">
<include name="**/*.java"/>
<exclude name="**/*Test*"/>
</fileset>
</pmd>
(Part 4 Coming Soon)

0 comments:
Post a Comment