Author: oching
Date: Fri Jun 30 02:37:11 2006
New Revision: 418216

URL: http://svn.apache.org/viewvc?rev=418216&view=rev
Log:
PR: PMD-34

Revised and updated plugin documentation.

Added:
    maven/plugins/trunk/maven-pmd-plugin/src/site/apt/examples/
    
maven/plugins/trunk/maven-pmd-plugin/src/site/apt/examples/generatingPmdAndCpd.apt
    maven/plugins/trunk/maven-pmd-plugin/src/site/apt/examples/usingRuleSets.apt
    
maven/plugins/trunk/maven-pmd-plugin/src/site/apt/examples/violationChecking.apt
    maven/plugins/trunk/maven-pmd-plugin/src/site/apt/faq.apt
    maven/plugins/trunk/maven-pmd-plugin/src/site/apt/overview.apt
    maven/plugins/trunk/maven-pmd-plugin/src/site/apt/usage.apt
Removed:
    maven/plugins/trunk/maven-pmd-plugin/src/site/apt/howto.apt
Modified:
    maven/plugins/trunk/maven-pmd-plugin/pom.xml
    
maven/plugins/trunk/maven-pmd-plugin/src/main/java/org/apache/maven/plugin/pmd/AbstractPmdViolationCheckMojo.java
    
maven/plugins/trunk/maven-pmd-plugin/src/main/java/org/apache/maven/plugin/pmd/CpdReport.java
    
maven/plugins/trunk/maven-pmd-plugin/src/main/java/org/apache/maven/plugin/pmd/CpdReportGenerator.java
    
maven/plugins/trunk/maven-pmd-plugin/src/main/java/org/apache/maven/plugin/pmd/CpdViolationCheckMojo.java
    
maven/plugins/trunk/maven-pmd-plugin/src/main/java/org/apache/maven/plugin/pmd/Locator.java
    
maven/plugins/trunk/maven-pmd-plugin/src/main/java/org/apache/maven/plugin/pmd/PmdReport.java
    
maven/plugins/trunk/maven-pmd-plugin/src/main/java/org/apache/maven/plugin/pmd/PmdReportListener.java
    
maven/plugins/trunk/maven-pmd-plugin/src/main/java/org/apache/maven/plugin/pmd/PmdViolationCheckMojo.java
    maven/plugins/trunk/maven-pmd-plugin/src/site/site.xml

Modified: maven/plugins/trunk/maven-pmd-plugin/pom.xml
URL: 
http://svn.apache.org/viewvc/maven/plugins/trunk/maven-pmd-plugin/pom.xml?rev=418216&r1=418215&r2=418216&view=diff
==============================================================================
--- maven/plugins/trunk/maven-pmd-plugin/pom.xml (original)
+++ maven/plugins/trunk/maven-pmd-plugin/pom.xml Fri Jun 30 02:37:11 2006
@@ -16,6 +16,9 @@
     fragments,
     as well as being able to fail the build based on these metrics.
   </description>
+  <prerequisites>
+    <maven>2.0</maven>
+  </prerequisites>
   <dependencies>
     <dependency>
       <groupId>org.apache.maven</groupId>
@@ -48,4 +51,17 @@
       <name>John Allen</name>
     </contributor>
   </contributors>
+  <reporting>
+    <plugins>
+      <plugin>
+        <artifactId>maven-javadoc-plugin</artifactId>
+      </plugin>
+      <plugin>
+        <artifactId>maven-jxr-plugin</artifactId>
+      </plugin>
+      <plugin>
+        <artifactId>maven-changelog-plugin</artifactId>
+      </plugin>
+    </plugins>
+  </reporting>
 </project>

Modified: 
maven/plugins/trunk/maven-pmd-plugin/src/main/java/org/apache/maven/plugin/pmd/AbstractPmdViolationCheckMojo.java
URL: 
http://svn.apache.org/viewvc/maven/plugins/trunk/maven-pmd-plugin/src/main/java/org/apache/maven/plugin/pmd/AbstractPmdViolationCheckMojo.java?rev=418216&r1=418215&r2=418216&view=diff
==============================================================================
--- 
maven/plugins/trunk/maven-pmd-plugin/src/main/java/org/apache/maven/plugin/pmd/AbstractPmdViolationCheckMojo.java
 (original)
+++ 
maven/plugins/trunk/maven-pmd-plugin/src/main/java/org/apache/maven/plugin/pmd/AbstractPmdViolationCheckMojo.java
 Fri Jun 30 02:37:11 2006
@@ -1,5 +1,21 @@
 package org.apache.maven.plugin.pmd;
 
+/*
+ * Copyright 2001-2006 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
 import org.apache.maven.plugin.AbstractMojo;
 import org.apache.maven.plugin.MojoExecutionException;
 import org.apache.maven.plugin.MojoFailureException;
@@ -94,6 +110,15 @@
         }
     }
 
+    /**
+     * Method for counting the number of violations found by the PMD tool
+     *
+     * @param xpp     the xml parser object
+     * @param tagName the element that will be checked
+     * @return an int that specifies the number of violations found
+     * @throws XmlPullParserException
+     * @throws IOException
+     */
     private int countViolations( XmlPullParser xpp, String tagName )
         throws XmlPullParserException, IOException
     {

Modified: 
maven/plugins/trunk/maven-pmd-plugin/src/main/java/org/apache/maven/plugin/pmd/CpdReport.java
URL: 
http://svn.apache.org/viewvc/maven/plugins/trunk/maven-pmd-plugin/src/main/java/org/apache/maven/plugin/pmd/CpdReport.java?rev=418216&r1=418215&r2=418216&view=diff
==============================================================================
--- 
maven/plugins/trunk/maven-pmd-plugin/src/main/java/org/apache/maven/plugin/pmd/CpdReport.java
 (original)
+++ 
maven/plugins/trunk/maven-pmd-plugin/src/main/java/org/apache/maven/plugin/pmd/CpdReport.java
 Fri Jun 30 02:37:11 2006
@@ -1,7 +1,7 @@
 package org.apache.maven.plugin.pmd;
 
 /*
- * Copyright 2005 The Apache Software Foundation.
+ * Copyright 2005-2006 The Apache Software Foundation.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.

Modified: 
maven/plugins/trunk/maven-pmd-plugin/src/main/java/org/apache/maven/plugin/pmd/CpdReportGenerator.java
URL: 
http://svn.apache.org/viewvc/maven/plugins/trunk/maven-pmd-plugin/src/main/java/org/apache/maven/plugin/pmd/CpdReportGenerator.java?rev=418216&r1=418215&r2=418216&view=diff
==============================================================================
--- 
maven/plugins/trunk/maven-pmd-plugin/src/main/java/org/apache/maven/plugin/pmd/CpdReportGenerator.java
 (original)
+++ 
maven/plugins/trunk/maven-pmd-plugin/src/main/java/org/apache/maven/plugin/pmd/CpdReportGenerator.java
 Fri Jun 30 02:37:11 2006
@@ -9,6 +9,8 @@
 import org.codehaus.plexus.util.StringUtils;
 
 /**
+ * Class that generated the CPD report.
+ *
  * @author mperham
  * @version $Id: $
  */
@@ -30,11 +32,19 @@
         this.xrefLocation = xrefLocation;
     }
 
+    /**
+     * Method that returns the title of the CPD Report
+     *
+     * @return a String that contains the title
+     */
     private String getTitle()
     {
         return bundle.getString( "report.cpd.title" );
     }
 
+    /**
+     * Method that generates the start of the CPD report.
+     */
     public void beginDocument()
     {
         sink.head();
@@ -68,10 +78,15 @@
         // TODO files summary
     }
 
+    /**
+     * Method that generates the contents of the CPD report
+     *
+     * @param matches
+     */
     public void generate( Iterator matches )
     {
         beginDocument();
-        
+
         while ( matches.hasNext() )
         {
             Match match = (Match) matches.next();
@@ -80,7 +95,7 @@
 
             String filename2 = match.getSecondMark().getTokenSrcID();
             filename2 = StringUtils.substring( filename2, 
sourceDirectory.length() + 1 );
-            
+
             String code = match.getSourceCodeSlice();
             int line1 = match.getFirstMark().getBeginLine();
             int line2 = match.getSecondMark().getBeginLine();
@@ -105,7 +120,8 @@
 
             if ( xrefLocation != null )
             {
-                sink.link( xrefLocation + "/" + filename1.replaceAll( 
"\\.java$", ".html" ).replace( '\\', '/' ) + "#" + line1 );
+                sink.link( xrefLocation + "/" + filename1.replaceAll( 
"\\.java$", ".html" ).replace( '\\', '/' ) + "#" +
+                    line1 );
             }
             sink.text( String.valueOf( line1 ) );
             if ( xrefLocation != null )
@@ -124,7 +140,8 @@
             sink.tableCell();
             if ( xrefLocation != null )
             {
-                sink.link( xrefLocation + "/" + filename2.replaceAll( 
"\\.java$", ".html" ).replace( '\\', '/' ) + "#" + line2 );
+                sink.link( xrefLocation + "/" + filename2.replaceAll( 
"\\.java$", ".html" ).replace( '\\', '/' ) + "#" +
+                    line2 );
             }
             sink.text( String.valueOf( line2 ) );
             if ( xrefLocation != null )
@@ -136,13 +153,13 @@
 
             // Source snippet
             sink.tableRow();
-            
+
             // TODO Cleaner way to do this?
-            sink.rawText("<td colspan='2'>");
-            sink.verbatim(false);
+            sink.rawText( "<td colspan='2'>" );
+            sink.verbatim( false );
             sink.text( code );
             sink.verbatim_();
-            sink.rawText("</td>");
+            sink.rawText( "</td>" );
             sink.tableRow_();
             sink.table();
             sink.paragraph_();

Modified: 
maven/plugins/trunk/maven-pmd-plugin/src/main/java/org/apache/maven/plugin/pmd/CpdViolationCheckMojo.java
URL: 
http://svn.apache.org/viewvc/maven/plugins/trunk/maven-pmd-plugin/src/main/java/org/apache/maven/plugin/pmd/CpdViolationCheckMojo.java?rev=418216&r1=418215&r2=418216&view=diff
==============================================================================
--- 
maven/plugins/trunk/maven-pmd-plugin/src/main/java/org/apache/maven/plugin/pmd/CpdViolationCheckMojo.java
 (original)
+++ 
maven/plugins/trunk/maven-pmd-plugin/src/main/java/org/apache/maven/plugin/pmd/CpdViolationCheckMojo.java
 Fri Jun 30 02:37:11 2006
@@ -29,6 +29,9 @@
 public class CpdViolationCheckMojo
     extends AbstractPmdViolationCheckMojo
 {
+    /**
+     * @see org.apache.maven.plugin.AbstractMojo#execute()
+     */
     public void execute()
         throws MojoExecutionException, MojoFailureException
     {

Modified: 
maven/plugins/trunk/maven-pmd-plugin/src/main/java/org/apache/maven/plugin/pmd/Locator.java
URL: 
http://svn.apache.org/viewvc/maven/plugins/trunk/maven-pmd-plugin/src/main/java/org/apache/maven/plugin/pmd/Locator.java?rev=418216&r1=418215&r2=418216&view=diff
==============================================================================
--- 
maven/plugins/trunk/maven-pmd-plugin/src/main/java/org/apache/maven/plugin/pmd/Locator.java
 (original)
+++ 
maven/plugins/trunk/maven-pmd-plugin/src/main/java/org/apache/maven/plugin/pmd/Locator.java
 Fri Jun 30 02:37:11 2006
@@ -1,7 +1,7 @@
 package org.apache.maven.plugin.pmd;
 
 /*
- * Copyright 2004-2005 The Apache Software Foundation.
+ * Copyright 2004-2006 The Apache Software Foundation.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -27,7 +27,7 @@
 import java.net.URL;
 
 /**
- * Performs Locator services for the <code>*Location</code> parameters in the 
+ * Performs Locator services for the <code>*Location</code> parameters in the
  * Reports.
  *
  * @author <a href="mailto:[EMAIL PROTECTED]">Joakim Erdfelt</a>
@@ -38,7 +38,7 @@
 
     /**
      * Create a Locator object.
-     * 
+     *
      * @param log the logger object to log with.
      */
     public Locator( Log log )
@@ -48,7 +48,7 @@
 
     /**
      * Obtain a Log object.
-     * 
+     *
      * @return the Log object.
      */
     private Log getLog()
@@ -61,17 +61,17 @@
     }
 
     /**
-     * <p>
+     * <p/>
      * Attempts to resolve a location parameter into a real file.
      * </p>
-     * 
-     * <p>
+     * <p/>
+     * <p/>
      * Checks a location string to for a resource, URL, or File that matches.
      * If a resource or URL is found, then a local file is created with that
      * locations contents.
      * </p>
-     * 
-     * @param location the location string to match against.
+     *
+     * @param location  the location string to match against.
      * @param localfile the local file to use in case of resource or URL.
      * @return the File of the resolved location.
      * @throws IOException if file is unable to be found or copied into 
<code>localfile</code> destination.

Modified: 
maven/plugins/trunk/maven-pmd-plugin/src/main/java/org/apache/maven/plugin/pmd/PmdReport.java
URL: 
http://svn.apache.org/viewvc/maven/plugins/trunk/maven-pmd-plugin/src/main/java/org/apache/maven/plugin/pmd/PmdReport.java?rev=418216&r1=418215&r2=418216&view=diff
==============================================================================
--- 
maven/plugins/trunk/maven-pmd-plugin/src/main/java/org/apache/maven/plugin/pmd/PmdReport.java
 (original)
+++ 
maven/plugins/trunk/maven-pmd-plugin/src/main/java/org/apache/maven/plugin/pmd/PmdReport.java
 Fri Jun 30 02:37:11 2006
@@ -1,7 +1,7 @@
 package org.apache.maven.plugin.pmd;
 
 /*
- * Copyright 2005 The Apache Software Foundation.
+ * Copyright 2005-2006 The Apache Software Foundation.
  * 
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -71,11 +71,11 @@
      * @parameter expression="${targetJdk}"
      */
     private String targetJdk;
-    
+
     /**
      * The rule priority threshold; rules with lower priority
      * than this will not be evaluated.
-     * 
+     *
      * @parameter expression="${minimumPriority}" default-value="5"
      */
     private int minimumPriority = 5;
@@ -86,8 +86,7 @@
      *
      * @parameter
      */
-    private String[] rulesets =
-        new String[]{"rulesets/basic.xml", "rulesets/unusedcode.xml", 
"rulesets/imports.xml",};
+    private String[] rulesets = new String[]{"rulesets/basic.xml", 
"rulesets/unusedcode.xml", "rulesets/imports.xml",};
 
     /**
      * The file encoding to use when reading the java source.
@@ -157,7 +156,7 @@
 
             Locator locator = new Locator( getLog() );
             RuleSetFactory ruleSetFactory = new RuleSetFactory();
-            ruleSetFactory.setMinimumPriority(this.minimumPriority);
+            ruleSetFactory.setMinimumPriority( this.minimumPriority );
             RuleSet[] sets = new RuleSet[rulesets.length];
             try
             {
@@ -240,6 +239,12 @@
         }
     }
 
+    /**
+     * Convenience method to get the location of the specified file name.
+     *
+     * @param name the name of the file whose location is to be resolved
+     * @return a String that contains the absolute file name of the file
+     */
     private String getLocationTemp( String name )
     {
         String loc = name;
@@ -291,6 +296,14 @@
         return "pmd";
     }
 
+    /**
+     * Convenience method to get the list of files where the PMD tool will be 
executed
+     *
+     * @param includes contains the concatenated list of files to be included
+     * @param excludes contains the concatenated list of files to be excluded
+     * @return a List of the files where the PMD tool will be executed
+     * @throws IOException
+     */
     private List getFilesToProcess( String includes, String excludes )
         throws IOException
     {
@@ -325,6 +338,12 @@
         return ResourceBundle.getBundle( "pmd-report", locale, 
PmdReport.class.getClassLoader() );
     }
 
+    /**
+     * Convenience method that concatenates the files to be excluded into the 
appropriate format
+     *
+     * @param exclude the array of Strings that contains the files to be 
excluded
+     * @return a String that contains the concatenates file names
+     */
     private String getExclusionsString( String[] exclude )
     {
         StringBuffer excludes = new StringBuffer();

Modified: 
maven/plugins/trunk/maven-pmd-plugin/src/main/java/org/apache/maven/plugin/pmd/PmdReportListener.java
URL: 
http://svn.apache.org/viewvc/maven/plugins/trunk/maven-pmd-plugin/src/main/java/org/apache/maven/plugin/pmd/PmdReportListener.java?rev=418216&r1=418215&r2=418216&view=diff
==============================================================================
--- 
maven/plugins/trunk/maven-pmd-plugin/src/main/java/org/apache/maven/plugin/pmd/PmdReportListener.java
 (original)
+++ 
maven/plugins/trunk/maven-pmd-plugin/src/main/java/org/apache/maven/plugin/pmd/PmdReportListener.java
 Fri Jun 30 02:37:11 2006
@@ -1,7 +1,7 @@
 package org.apache.maven.plugin.pmd;
 
 /*
- * Copyright 2005 The Apache Software Foundation.
+ * Copyright 2005-2006 The Apache Software Foundation.
  * 
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -99,8 +99,7 @@
         {
             public int compare( Object o1, Object o2 )
             {
-                return ( (RuleViolation) o1 ).getBeginLine() -
-                    ( (RuleViolation) o2 ).getBeginLine();
+                return ( (RuleViolation) o1 ).getBeginLine() - ( 
(RuleViolation) o2 ).getBeginLine();
             }
         } );
 
@@ -119,7 +118,7 @@
             int endLine = ruleViolation.getEndLine();
             if ( endLine != beginLine )
             {
-                sink.text( " - ");
+                sink.text( " - " );
                 outputLineLink( endLine );
             }
 

Modified: 
maven/plugins/trunk/maven-pmd-plugin/src/main/java/org/apache/maven/plugin/pmd/PmdViolationCheckMojo.java
URL: 
http://svn.apache.org/viewvc/maven/plugins/trunk/maven-pmd-plugin/src/main/java/org/apache/maven/plugin/pmd/PmdViolationCheckMojo.java?rev=418216&r1=418215&r2=418216&view=diff
==============================================================================
--- 
maven/plugins/trunk/maven-pmd-plugin/src/main/java/org/apache/maven/plugin/pmd/PmdViolationCheckMojo.java
 (original)
+++ 
maven/plugins/trunk/maven-pmd-plugin/src/main/java/org/apache/maven/plugin/pmd/PmdViolationCheckMojo.java
 Fri Jun 30 02:37:11 2006
@@ -29,6 +29,9 @@
 public class PmdViolationCheckMojo
     extends AbstractPmdViolationCheckMojo
 {
+    /**
+     * @see org.apache.maven.plugin.AbstractMojo#execute()
+     */
     public void execute()
         throws MojoExecutionException, MojoFailureException
     {

Added: 
maven/plugins/trunk/maven-pmd-plugin/src/site/apt/examples/generatingPmdAndCpd.apt
URL: 
http://svn.apache.org/viewvc/maven/plugins/trunk/maven-pmd-plugin/src/site/apt/examples/generatingPmdAndCpd.apt?rev=418216&view=auto
==============================================================================
--- 
maven/plugins/trunk/maven-pmd-plugin/src/site/apt/examples/generatingPmdAndCpd.apt
 (added)
+++ 
maven/plugins/trunk/maven-pmd-plugin/src/site/apt/examples/generatingPmdAndCpd.apt
 Fri Jun 30 02:37:11 2006
@@ -0,0 +1,43 @@
+ ------
+ Using PMD and CPD Reports
+ ------
+ 30 June 2006
+ ------
+
+
+
+Using PMD And CPD Reports
+
+  The PMD and CPD reports share the same configuration.  For example, the 
following
+  tells Maven to run the PMD and CPD report as part of the site report 
generation, use the default rule sets:
+  'basic', 'unused' and 'imports'. Note that HTML is always generated in 
addition to any other alternate format.
+  Legal formats are "html", "csv", "xml" and "txt".
+
+  The reports will link directly to the cross-referenced source if you enable 
this with the linkXRef parameter.
+  See the {{{http://maven.apache.org/maven-jxr-plugin/}JXR}} plugin for more 
details.
+
+  If your source uses a non-default encoding, you can use the sourceEncoding 
parameter to tell Maven which
+  encoding to use when reading the java source.
+
+  You can configure the minimum code size which trips the CPD.  The default of 
100 tokens corresponds
+  to approxiamately 5-10 lines of code.
+
+  Since PMD parses the Java source, it needs to know which Java version to 
use.  The default is 1.4. The following is a
+  possible configuration:
+
++-----+
+<reporting>
+  <plugins>
+    <plugin>
+      <groupId>org.apache.maven.plugins</groupId>
+      <artifactId>maven-pmd-plugin</artifactId>
+      <configuration>
+        <sourceEncoding>utf-8</sourceEncoding>
+        <minimumTokens>100</minimumTokens>
+        <targetJdk>1.5</targetJdk>
+        <minimumPriority>5</minimumPriority>
+      </configuration>
+    </plugin>
+  </plugins>
+</reporting>
++-----+
\ No newline at end of file

Added: 
maven/plugins/trunk/maven-pmd-plugin/src/site/apt/examples/usingRuleSets.apt
URL: 
http://svn.apache.org/viewvc/maven/plugins/trunk/maven-pmd-plugin/src/site/apt/examples/usingRuleSets.apt?rev=418216&view=auto
==============================================================================
--- 
maven/plugins/trunk/maven-pmd-plugin/src/site/apt/examples/usingRuleSets.apt 
(added)
+++ 
maven/plugins/trunk/maven-pmd-plugin/src/site/apt/examples/usingRuleSets.apt 
Fri Jun 30 02:37:11 2006
@@ -0,0 +1,40 @@
+ ------
+ Using Rule Sets
+ ------
+ Maria Odea Ching
+ ------
+ 30 June 2006
+ ------
+
+
+Using Rule Sets
+
+ The PMD plugin uses three default rule sets: basic.xml, unusedcode.xml and 
imports.xml. These rule sets are bundled in
+ the PMD code analysis tool. To use other rule sets, you can configure the 
plugin as shown below:
+
++-----+
+<reporting>
+  <plugins>
+    <plugin>
+      <groupId>org.apache.maven.plugins</groupId>
+      <artifactId>maven-pmd-plugin</artifactId>
+      <configuration>
+        <rulesets>
+          <ruleset>/rules/braces.xml</ruleset>
+          <ruleset>/rules/naming.xml</ruleset>
+          <ruleset>d:\rulesets\strings.xml</ruleset>
+          <ruleset>http://localhost/design.xml</ruleset>
+        </rulesets>
+      </configuration>
+    </plugin>
+  </plugins>
+</reporting>
++-----+
+
+ The rulesets may reside in the classpath, filesystem or at a URL. For rule 
sets that are already bundled with the PMD tool,
+ you do not need to specificy the absolute path of the file. It will be 
resolved by the plugin. But if the rule set is a
+ custom rule set, you need to specify its absolute path.
+
+
+
+

Added: 
maven/plugins/trunk/maven-pmd-plugin/src/site/apt/examples/violationChecking.apt
URL: 
http://svn.apache.org/viewvc/maven/plugins/trunk/maven-pmd-plugin/src/site/apt/examples/violationChecking.apt?rev=418216&view=auto
==============================================================================
--- 
maven/plugins/trunk/maven-pmd-plugin/src/site/apt/examples/violationChecking.apt
 (added)
+++ 
maven/plugins/trunk/maven-pmd-plugin/src/site/apt/examples/violationChecking.apt
 Fri Jun 30 02:37:11 2006
@@ -0,0 +1,35 @@
+ ------
+ Violation Checking
+ ------
+ 23 June 2006
+ ------
+
+ 
+
+Violation Checking
+
+  The pmd:check and pmd:cpd-check goals allow you to configure your build to 
fail if any errors are found in the PMD or
+  CPD reports respectively and, in doing so, enforce your own custom code 
quality rules.
+
+  The following code fragment enables both the standard PMD check and the CPD 
check in a build, during the <<<verify>>>
+  phase.
+
++-----+
+<build>
+  <plugins>
+    <plugin>
+      <groupId>org.apache.maven.plugins</groupId>
+      <artifactId>maven-pmd-plugin</artifactId>
+      <executions>
+        <execution>
+          <goals>
+            <goal>check</goal>
+            <goal>cpd-check</goal>
+          </goals>
+        </execution>
+      </executions>
+    </plugin>
+  </plugins>
+</build>
++-----+
+

Added: maven/plugins/trunk/maven-pmd-plugin/src/site/apt/faq.apt
URL: 
http://svn.apache.org/viewvc/maven/plugins/trunk/maven-pmd-plugin/src/site/apt/faq.apt?rev=418216&view=auto
==============================================================================
--- maven/plugins/trunk/maven-pmd-plugin/src/site/apt/faq.apt (added)
+++ maven/plugins/trunk/maven-pmd-plugin/src/site/apt/faq.apt Fri Jun 30 
02:37:11 2006
@@ -0,0 +1,13 @@
+ ------
+ FAQs
+ ------
+ Maria Odea Ching
+ ------
+ 30 June 2006
+ ------
+
+
+
+FAQs
+
+ Below are frequently asked questions for the PMD plugin:

Added: maven/plugins/trunk/maven-pmd-plugin/src/site/apt/overview.apt
URL: 
http://svn.apache.org/viewvc/maven/plugins/trunk/maven-pmd-plugin/src/site/apt/overview.apt?rev=418216&view=auto
==============================================================================
--- maven/plugins/trunk/maven-pmd-plugin/src/site/apt/overview.apt (added)
+++ maven/plugins/trunk/maven-pmd-plugin/src/site/apt/overview.apt Fri Jun 30 
02:37:11 2006
@@ -0,0 +1,41 @@
+ ------
+ Overview
+ ------
+ 06 January 2006
+ ------
+
+Overview
+
+  The {{{http://pmd.sourceforge.net/}PMD}} plugin allows you to automatically 
run the PMD code analysis tool
+  on your project's source code and generate a site report with its results. 
It supports the standard functions
+  provided by the PMD tool including the Copy/Paste Detector or CPD.
+
+  The plugin accepts configuration parameters that will be used to customize 
the execution of the PMD tool.
+
+
+* Goals Overview
+
+  The PMD plugin has 4 goals:
+
+  * {{{index.html}pmd:pmd}} creates a PMD site report based on the rulesets 
and configuration set in the plugin. It can also
+    generate a pmd output file aside from the site report in any of the 
following formats: xml, csv or txt.
+
+  * {{{index.html}pmd:cpd}} generates a report for PMD's Copy/Paste Detector 
(CPD) tool. Same as with the pmd:pmd goal, it can
+    also generate a cpd output file in any of these formats: xml, csv or txt.
+
+  * {{{index.html}pmd:check}} verifies that the PMD report is empty and fail 
the build if it is not. This goal is executed by
+    default when pmd:pmd is executed.
+
+  * {{{index.html}pmd:cpd-check}} verifies that the CPD report is empty and 
fail the build if it is not. This goal is also
+    executed by default when pmd:cpd is executed.
+
+* Usage
+
+   Some basic instructions for configuring and using the mojos of the 
<<<maven-pmd-plugin>>> can be found in
+   the {{{usage.html}Usage guide}}.
+
+* Examples
+
+   Sample use-cases for the plugin are available under the Examples menu.
+
+

Added: maven/plugins/trunk/maven-pmd-plugin/src/site/apt/usage.apt
URL: 
http://svn.apache.org/viewvc/maven/plugins/trunk/maven-pmd-plugin/src/site/apt/usage.apt?rev=418216&view=auto
==============================================================================
--- maven/plugins/trunk/maven-pmd-plugin/src/site/apt/usage.apt (added)
+++ maven/plugins/trunk/maven-pmd-plugin/src/site/apt/usage.apt Fri Jun 30 
02:37:11 2006
@@ -0,0 +1,48 @@
+ ------
+ Usage
+ ------
+ Maria Odea Ching
+ ------
+ 23 June 2006
+ ------
+
+
+Usage
+
+  The PMD plugin generates PMD and CPD reports using the PMD code analysis 
tool.
+
+  To include a report with default rule sets and configuration in your project 
site, set the following in the \<reporting\>
+  section of your pom:
+
++-----+
+<reporting>
+  <plugins>
+    <plugin>
+      <groupId>org.apache.maven.plugins</groupId>
+      <artifactId>maven-pmd-plugin</artifactId>
+    </plugin>
+  </plugins>
+</reporting>
++-----+
+
+  You can also explicitly execute the PMD plugin and generate the same report 
by setting the plugin in the \<build\>
+  section of your pom as shown below:
+
++-----+
+<build>
+  <plugins>
+    <plugin>
+      <groupId>org.apache.maven.plugins</groupId>
+      <artifactId>maven-pmd-plugin</artifactId>
+    </plugin>
+  </plugins>
+</build>
++-----+
+
+
+
+
+
+
+
+ 
\ No newline at end of file

Modified: maven/plugins/trunk/maven-pmd-plugin/src/site/site.xml
URL: 
http://svn.apache.org/viewvc/maven/plugins/trunk/maven-pmd-plugin/src/site/site.xml?rev=418216&r1=418215&r2=418216&view=diff
==============================================================================
--- maven/plugins/trunk/maven-pmd-plugin/src/site/site.xml (original)
+++ maven/plugins/trunk/maven-pmd-plugin/src/site/site.xml Fri Jun 30 02:37:11 
2006
@@ -15,7 +15,15 @@
     </links>
 
     <menu name="Overview">
-      <item name="How to Use" href="howto.html"/>
+      <item name="Overview" href="overview.html"/>
+      <item name="Usage" href="usage.html"/>
+      <item name="FAQ" href="faq.html"/>
+    </menu>
+
+    <menu name="Examples">
+      <item name="Generating PMD and CPD Reports" 
href="examples/generatingPmdAndCpd.html"/>
+      <item name="Using Rule Sets" href="examples/usingRuleSets.html"/>
+      <item name="Violation Checking" href="examples/violationChecking.html"/>
     </menu>
     ${reports}
   </body>


Reply via email to