brett 2004/06/11 20:19:36 Modified: pmd plugin.properties project.xml pmd/xdocs changes.xml index.xml navigation.xml Added: pmd/xdocs faq.fml Removed: pmd/src/plugin-resources/rulesets basic.xml braces.xml codesize.xml controversial.xml coupling.xml design.xml experimental.xml favorites.xml imports.xml junit.xml naming.xml newrules.xml strings.xml unusedcode.xml pmd/xdocs how-to.xml Log: PR: MPPMD-2 Submitted By: Joakim Erdfelt Reviewed By: Brett Porter PMD plugin cleanup. Rulesets are kept inside PMD jar, upgraded to v1.3. Clean documentation. Revision Changes Path 1.7 +1 -1 maven-plugins/pmd/plugin.properties Index: plugin.properties =================================================================== RCS file: /home/cvs/maven-plugins/pmd/plugin.properties,v retrieving revision 1.6 retrieving revision 1.7 diff -u -r1.6 -r1.7 --- plugin.properties 4 Mar 2004 18:38:43 -0000 1.6 +++ plugin.properties 12 Jun 2004 03:19:36 -0000 1.7 @@ -27,7 +27,7 @@ # comma seperated list of rules to use # rulesets/experimental.xml is, well, experimental ... use at your own risk -maven.pmd.rulesetfiles=${plugin.resources}/rulesets/basic.xml,${plugin.resources}/rulesets/unusedcode.xml,${plugin.resources}/rulesets/imports.xml +maven.pmd.rulesetfiles=rulesets/basic.xml,rulesets/unusedcode.xml,rulesets/imports.xml maven.pmd.includes = **/*.java maven.pmd.excludes = 1.26 +10 -2 maven-plugins/pmd/project.xml Index: project.xml =================================================================== RCS file: /home/cvs/maven-plugins/pmd/project.xml,v retrieving revision 1.25 retrieving revision 1.26 diff -u -r1.25 -r1.26 --- project.xml 16 May 2004 01:35:47 -0000 1.25 +++ project.xml 12 Jun 2004 03:19:36 -0000 1.26 @@ -23,7 +23,7 @@ <pomVersion>3</pomVersion> <id>maven-pmd-plugin</id> <name>Maven PMD Plug-in</name> - <currentVersion>1.4</currentVersion> + <currentVersion>1.5-SNAPSHOT</currentVersion> <description>The Maven PMD plugin is a plugin that wraps the PMD framework (http://pmd.sourceforge.net). PMD is a source checking framework that works by scanning Java source code and looks for potential problems like: unused local variables, empty catch blocks, unused parameters, empty 'if' statements, etc.</description> <shortDescription>Maven Plugin for PMD</shortDescription> <url>http://maven.apache.org/reference/plugins/pmd/</url> @@ -90,11 +90,19 @@ </roles> </developer> </developers> + <contributors> + <contributor> + <name>Joakim Erdfelt</name> + <email>[EMAIL PROTECTED]</email> + <organization>Solshen Inc</organization> + <timezone>-5</timezone> + </contributor> + </contributors> <dependencies> <dependency> <groupId>pmd</groupId> <artifactId>pmd</artifactId> - <version>1.2.1</version> + <version>1.3</version> <url>http://pmd.sourceforge.net</url> </dependency> <dependency> 1.22 +5 -0 maven-plugins/pmd/xdocs/changes.xml Index: changes.xml =================================================================== RCS file: /home/cvs/maven-plugins/pmd/xdocs/changes.xml,v retrieving revision 1.21 retrieving revision 1.22 diff -u -r1.21 -r1.22 --- changes.xml 16 May 2004 01:30:52 -0000 1.21 +++ changes.xml 12 Jun 2004 03:19:36 -0000 1.22 @@ -25,6 +25,11 @@ <author email="[EMAIL PROTECTED]">Vincent Massol</author> </properties> <body> + <release version="1.5-SNAPSHOT" date="in CVS"> + <action dev="brett" due-to="Joakim Erdfelt" issue="MPPMD-2" type="update"> + Upgrade to PMD 1.3, clean up and improve documentation. + </action> + </release> <release version="1.4" date="2004-05-15"> <action dev="brett" type="fix" issue="MPPMD-7">Create directories that exist under maven.build.dir before using them so it works after clean.</action> <action dev="brett" type="fix">Fix usage of the maven.pmd.cpd.enable property so it is disabled when set to false (the default)</action> 1.3 +4 -72 maven-plugins/pmd/xdocs/index.xml Index: index.xml =================================================================== RCS file: /home/cvs/maven-plugins/pmd/xdocs/index.xml,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- index.xml 4 Mar 2004 18:38:43 -0000 1.2 +++ index.xml 12 Jun 2004 03:19:36 -0000 1.3 @@ -32,79 +32,11 @@ This plugin generates a report of the PMD static source code analyzer. </p> + + <p> + See the <a href="faq.html">FAQ</a> for more information on Installation / Use / Configuring. + </p> - <subsection name="Installation"> - - <p> - Copy the downloaded plugin into the Maven plugin directory. - Any older version of the plugin should to be deleted to make - sure that the newest plugin is called - </p> - - <p> - Download the PMD binary distribution and put the PMD - jar into the repository. This has to be done manually - unless PMD is hosted on the Maven remote repository. - </p> - - <p> - Run "maven -g" and look out for documented PMD goals. - If you see some then the unpacking succeeded. - </p> - - <p> - The PMD plugin can be started through "maven pmd" - or integrated by using the following code snippet in - maven.xml: - </p> - - <source> -<![CDATA[ -<?xml version="1.0"?> - <preGoal name="site:generate"> - <attainGoal name="pmd"/> - </preGoal> -]]> - </source> - - <p> - The generated report has to be added manually to the - website which is usually done with navigation.xml. - </p> - - <source> -<![CDATA[ -<?xml version="1.0"?> - <menu name="Custom Reports"> - <item name="PMD Report" href="/pmd-report.html"/> - <!-- Add more custom reports here --> - </menu> -]]> - </source> - - <p> - Another way to integrate the PMD plugin is to add it to the <reports> - section in your project.xml: - </p> - - <source> -<![CDATA[ - <reports> - <report>maven-jdepend-plugin</report> - <report>maven-checkstyle-plugin</report> - <report>maven-pmd-plugin</report> - <report>maven-changelog-plugin</report> - <report>maven-file-activity-plugin</report> - <report>maven-developer-activity-plugin</report> - <report>maven-javadoc-plugin</report> - <report>maven-jxr-plugin</report> - <report>maven-junit-report-plugin</report> - <report>maven-tasklist-plugin</report> - </reports> -]]> - </source> - - </subsection> <subsection name="Thanks to ..."> 1.7 +5 -1 maven-plugins/pmd/xdocs/navigation.xml Index: navigation.xml =================================================================== RCS file: /home/cvs/maven-plugins/pmd/xdocs/navigation.xml,v retrieving revision 1.6 retrieving revision 1.7 diff -u -r1.6 -r1.7 --- navigation.xml 2 May 2004 10:26:36 -0000 1.6 +++ navigation.xml 12 Jun 2004 03:19:36 -0000 1.7 @@ -23,11 +23,15 @@ <title>Maven PMD Plugin</title> <body> + <links> + <item name="Maven" href="http://maven.apache.org/"/> + <item name="PMD" href="http://pmd.sourceforge.net/"/> + </links> <menu name="Home"> <item name="Front Page" href="/index.html"/> <item name="Properties" href="/properties.html"/> <item name="Sample" href="/images/sample.gif"/> - <item name="How To's" href="/how-to.html"/> + <item name="FAQs" href="/faq.html"/> </menu> </body> 1.1 maven-plugins/pmd/xdocs/faq.fml Index: faq.fml =================================================================== <?xml version="1.0" encoding="UTF-8"?> <faqs title="Frequently Asked Questions"> <part id="general"> <title>General</title> <faq id="whats-pmd"> <question> What is PMD? </question> <answer> <p>According to the official website ( <a href="http://pmd.sourceforge.net/">pmd.sourceforge.net</a> ), PMD scans Java source code and looks for potential problems like: </p> <ul> <li>Unused local variables</li> <li>Empty catch blocks</li> <li>Unused parameters</li> <li>Empty 'if' statements</li> <li>Duplicate import statements</li> <li>Unused private methods</li> <li>Classes which could be Singletons</li> <li>Short/long variable and method names</li> </ul> <p>This plugin provides a means to integrate the pmd report into the maven process.</p> </answer> </faq> </part> <part id="installation"> <title>Installation</title> <faq id="basic-install"> <question> How do I install the maven-pmd-plugin? </question> <answer> <p> The maven-pmd-plugin is considered an optional maven-plugin, but the default installation of maven comes with it. There is nothing special you need to do, other than use it. see <a href="#basic-usage">Basic Usage</a> for examples on how to use it. </p> </answer> </faq> <faq id="manual-install"> <question> I want to install a different version of the maven-pmd-plugin than what is available to me right now. How do I do that? </question> <answer> <p> Starting with the <a href="http://maven.apache.org/reference/plugins/plugin/"> maven-plugin-plugin</a> 1.2 (which first appeared with maven 1.0-rc1), you issue the following command to maven to download the version of your choice. </p> <source> <![CDATA[ $ maven -DgroupId=maven -DartifactId=maven-pmd-plugin -Dtype=plugin -Dversion=1.3 plugin:download ]]> </source> <p> This command will download the plugin, remove the other versions of the maven-pmd-plugin and make this recently downloaded version immediately available to all projects that depend on maven-pmd-plugin. </p> </answer> </faq> </part> <part id="usage"> <title>Usage</title> <faq id="basic-usage"> <question> How do I use it? </question> <answer> <p> The quickest, and easiest way to use the maven-pmd-plugin is to add the <code>maven-pmd-plugin</code> entry to your <a href="http://maven.apache.org/reference/project-descriptor.html#reports"> reports</a> section in your project's project.xml <a href="http://maven.apache.org/reference/project-descriptor.html"> project descriptor</a>. </p> <source> <![CDATA[ <reports> ... <report>maven-pmd-plugin</report> ... </reports> ]]> </source> </answer> </faq> <faq id="manual-running"> <question> I don't want to use it via the project.xml. What are my options? </question> <answer> <p> The PMD plugin can be started through "maven pmd" or integrated by using the following code snippet in maven.xml: </p> <source> <![CDATA[ <?xml version="1.0"?> <preGoal name="site:generate"> <attainGoal name="pmd"/> </preGoal> ]]> </source> <p> The generated report has to be added manually to the website which is usually done with navigation.xml. </p> <source> <![CDATA[ <?xml version="1.0"?> <menu name="Custom Reports"> <item name="PMD Report" href="/pmd-report.html"/> <!-- Add more custom reports here --> </menu> ]]> </source> </answer> </faq> <faq id="disable-subproject"> <question> I have a large projects with many sub-projects, I want to use the maven-pmd-plugin, but not for a specific sub-project. How do I accomplish this? </question> <answer> <p> Assume that you have generated a DB layer having a few hundreds Java source files. Apart from being curious you don't want to have a PMD report for generated source files. Simply put <code>maven.pmd.enable=false</code> into your <code>project properties</code> for that one sub-project. </p> </answer> </faq> <faq id="disable-select-files"> <question> How do I disable certain files from being checked by the maven-pmd-plugin? </question> <answer> <p> The maven-pmd-plugin will scan all <code>*.java</code> files in your defined <code><sourceDirectory></code> path specified in your <a href="http://maven.apache.org/reference/project-descriptor.html"> project descriptor</a>. </p> <p> Use the <code>maven.pmd.excludes</code> property to exclude certain files from being checked by the maven-pmd-plugin. </p> <p> Lets assume that you have generated a DB layer within your project. Simply put <code>maven.pmd.excludes=**/database/**</code> into your <code>project.properties</code> file to exclude the files in your database directory and below. </p> </answer> </faq> <faq id="zillion-violations"> <question> How do I get rid of these zillions of rule violations? </question> <answer> <p> You could fix the rule violations. </p> <p> On the other hand, if you want to configure the maven-pmd-plugin to pick and choose the type of tests to perform, then you need to specify your ruleset. </p> <p> There are two ways to accomplish this. <ol> <li> <p> Define which default pmd rulesets you want to use in the <code>maven.pmd.rulesetfiles</code> property. </p> <p> The default setting for the <code>maven.pmd.rulesetfiles</code> property is: <source> <![CDATA[ maven.pmd.rulesetfiles = rulesets/basic.xml,rulesets/unusedcode.xml,rulesets/imports.xml ]]> </source> </p> <p> The following list of default pmd rulesets was obtained from the <a href="http://pmd.sourceforge.net/">official pmd project</a> page. <ul> <li><a href="http://pmd.sourceforge.net/rules/basic.html">Basic</a> = <code>ruleset/basic.xml</code>.</li> <li><a href="http://pmd.sourceforge.net/rules/naming.html">Naming</a> = <code>ruleset/naming.xml</code>.</li> <li><a href="http://pmd.sourceforge.net/rules/unusedcode.html">Unused Code</a> = <code>ruleset/unusedcode.xml</code>.</li> <li><a href="http://pmd.sourceforge.net/rules/design.html">Design</a> = <code>ruleset/design.xml</code>.</li> <li><a href="http://pmd.sourceforge.net/rules/imports.html">Import Statements</a> = <code>ruleset/imports.xml</code>.</li> <li><a href="http://pmd.sourceforge.net/rules/junit.html">JUnit Tests</a> = <code>ruleset/junit.xml</code>.</li> <li><a href="http://pmd.sourceforge.net/rules/strings.html">Strings</a> = <code>ruleset/strings.xml</code>.</li> <li><a href="http://pmd.sourceforge.net/rules/braces.html">Braces</a> = <code>ruleset/braces.xml</code>.</li> <li><a href="http://pmd.sourceforge.net/rules/codesize.html">Code Size</a> = <code>ruleset/codesize.xml</code>.</li> <li><a href="http://pmd.sourceforge.net/rules/javabeans.html">Javabeans</a> = <code>ruleset/javabeans.xml</code>.</li> <li><a href="http://pmd.sourceforge.net/rules/coupling.html">Coupling</a> = <code>ruleset/coupling.xml</code>.</li> <li><a href="http://pmd.sourceforge.net/rules/strictexception.html">Strict Exceptions</a> = <code>ruleset/strictexception.xml</code>.</li> <li><a href="http://pmd.sourceforge.net/rules/controversial.html">Controversial</a> = <code>ruleset/controversial.xml</code>.</li> </ul> </p> </li> <li> <p> Define a custom ruleset.xml and reference it via the <code>maven.pmd.rulesetfiles</code> property. </p> <p> Example of a custom ruleset, saved as file called <code>favorite-pmd.xml</code> in your project root. <source> <![CDATA[ <?xml version="1.0"?> <ruleset name="Favorites"> <description> The Favorites ruleset contains links to rules that I like to use. I like the basic.xml, unusedcode.xml, and import.xml, and some of the rules in design.xml, strings.xml, and controversial.xml. </description> <rule ref="rulesets/basic.xml" /> <rule ref="rulesets/unusedcode.xml" /> <rule ref="rulesets/import.xml" /> <rule ref="rulesets/design.xml/SimplifyBooleanReturnsRule" /> <rule ref="rulesets/design.xml/SwitchStmtsShouldHaveDefault" /> <rule ref="rulesets/strings.xml/StringToString" /> <rule ref="rulesets/strings.xml/StringInstantiation" /> <rule ref="rulesets/controversial.xml/UnnecessaryConstructorRule" /> <rule ref="rulesets/controversial.xml/NullAssignment" /> <rule ref="rulesets/controversial.xml/UnusedModifier" /> </ruleset> ]]> </source> </p> <p> How it's referenced in your <code>project.properties</code> file. <source> <![CDATA[ maven.pmd.rulesetfiles = ${basedir}/favorite-pmd.xml ]]> </source> </p> </li> </ol> </p> </answer> </faq> <faq id="how-to-upgrade-pmd-jar"> <question> How do I manually upgrade to a newer PMD jar? </question> <answer> <p> The JAR picked up the plugin is defined in $MAVEN_HOME/plugins/pmd/project.xml and can be changed. </p> </answer> </faq> </part> </faqs>
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]