Publish PMD Report

Version 1 by Steve Luo
on Jun 10, 2010 18:46.


 
compared with
Current by Steve Luo
on May 25, 2011 16:16.


 
Key
These lines were removed. This word was removed.
These lines were added. This word was added.

View page history


There are 1 changes. View first change.

 To publish [PMD|http://pmd.sourceforge.net] report, you only need two steps:
 # Generate PMD *XML* report from [Ant|http://ant.apache.org] or [Maven|http://maven.apache.org] or any other build tool.
 # Add PMD report publish step by choosing _Publish -> PMD Report_ from step menu.
  
 h2. Generate PMD Report
  
 QuickBuild will NOT generate [PMD|http://pmd.sourceforge.net] report automatically, so first make sure the PMD report is produced by [ANT|http://ant.apache.org] or by any other build tool. The following example shows how to generate PMD XML report with [PMD Ant task|http://pmd.sourceforge.net/ant-task.html]:
 {code:xml|title= CheckStyle target in build.xml}
 <taskdef name="pmd" classname="net.sourceforge.pmd.ant.PMDTask"/>
  
 <target name="pmd">
  <taskdef name="pmd" classname="net.sourceforge.pmd.ant.PMDTask"/>
  <pmd rulesetfiles="imports.xml,unusedcode">
  <formatter type="xml" toFile="c:\pmd_report.xml"/>
  <fileset dir="C:\j2sdk1.4.1_01\src\java\lang\">
  <include name="**/*.java"/>
  </fileset>
  </pmd>
 </target>
 {code}
  
 {note:title="Be Careful"}
 Please don't use 'shortFileNames' attribute for PMD task, or set this attribute to false instead, otherwise QuickBuild will not open the source code correctly.
 {note}
  
 After adding the target, you can generate the XML report for your source code, and after that you can tell QuickBuild to publish the results.
  
 h2. Publish PMD Report
 Add _*Publish PMD Report*_ step to your build workflow. If you have several report sets, you can add several steps with different report set names. Reference [this page|Publish Build Reports] for more details.
   
 {note:title=Note}
 The publish PMD report step should run on the same node as you run pmd tasks, otherwise, you may not view source code correctly.
 {note}