From 9c7c08b449811b777a764044adafe79f995a06a3 Mon Sep 17 00:00:00 2001
From: brett
Date: Sat, 12 Jun 2004 03:19:36 +0000
Subject: [PATCH] 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.
git-svn-id: https://svn.apache.org/repos/asf/maven/maven-1/plugins/trunk@115459 13f79535-47bb-0310-9956-ffa450edef68
---
pmd/plugin.properties | 2 +-
pmd/project.xml | 12 +-
pmd/src/plugin-resources/rulesets/basic.xml | 375 ------------------
pmd/src/plugin-resources/rulesets/braces.xml | 146 -------
.../plugin-resources/rulesets/codesize.xml | 255 ------------
.../rulesets/controversial.xml | 187 ---------
.../plugin-resources/rulesets/coupling.xml | 89 -----
pmd/src/plugin-resources/rulesets/design.xml | 321 ---------------
.../rulesets/experimental.xml | 108 -----
.../plugin-resources/rulesets/favorites.xml | 42 --
pmd/src/plugin-resources/rulesets/imports.xml | 124 ------
pmd/src/plugin-resources/rulesets/junit.xml | 110 -----
pmd/src/plugin-resources/rulesets/naming.xml | 124 ------
.../plugin-resources/rulesets/newrules.xml | 49 ---
pmd/src/plugin-resources/rulesets/strings.xml | 101 -----
.../plugin-resources/rulesets/unusedcode.xml | 111 ------
pmd/xdocs/changes.xml | 5 +
pmd/xdocs/faq.fml | 306 ++++++++++++++
pmd/xdocs/how-to.xml | 94 -----
pmd/xdocs/index.xml | 76 +---
pmd/xdocs/navigation.xml | 6 +-
21 files changed, 331 insertions(+), 2312 deletions(-)
delete mode 100644 pmd/src/plugin-resources/rulesets/basic.xml
delete mode 100644 pmd/src/plugin-resources/rulesets/braces.xml
delete mode 100644 pmd/src/plugin-resources/rulesets/codesize.xml
delete mode 100644 pmd/src/plugin-resources/rulesets/controversial.xml
delete mode 100644 pmd/src/plugin-resources/rulesets/coupling.xml
delete mode 100644 pmd/src/plugin-resources/rulesets/design.xml
delete mode 100644 pmd/src/plugin-resources/rulesets/experimental.xml
delete mode 100644 pmd/src/plugin-resources/rulesets/favorites.xml
delete mode 100644 pmd/src/plugin-resources/rulesets/imports.xml
delete mode 100644 pmd/src/plugin-resources/rulesets/junit.xml
delete mode 100644 pmd/src/plugin-resources/rulesets/naming.xml
delete mode 100644 pmd/src/plugin-resources/rulesets/newrules.xml
delete mode 100644 pmd/src/plugin-resources/rulesets/strings.xml
delete mode 100644 pmd/src/plugin-resources/rulesets/unusedcode.xml
create mode 100644 pmd/xdocs/faq.fml
delete mode 100644 pmd/xdocs/how-to.xml
diff --git a/pmd/plugin.properties b/pmd/plugin.properties
index 146b7af7..6ccf5cbb 100644
--- a/pmd/plugin.properties
+++ b/pmd/plugin.properties
@@ -27,7 +27,7 @@ maven.pmd.enable = true
# 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 =
diff --git a/pmd/project.xml b/pmd/project.xml
index 60fe7d28..e4e03445 100644
--- a/pmd/project.xml
+++ b/pmd/project.xml
@@ -23,7 +23,7 @@
3maven-pmd-pluginMaven PMD Plug-in
- 1.4
+ 1.5-SNAPSHOTThe 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.Maven Plugin for PMDhttp://maven.apache.org/reference/plugins/pmd/
@@ -90,11 +90,19 @@
+
+
+ Joakim Erdfelt
+ joakim@erdfelt.net
+ Solshen Inc
+ -5
+
+ pmdpmd
- 1.2.1
+ 1.3http://pmd.sourceforge.net
diff --git a/pmd/src/plugin-resources/rulesets/basic.xml b/pmd/src/plugin-resources/rulesets/basic.xml
deleted file mode 100644
index 5cce9986..00000000
--- a/pmd/src/plugin-resources/rulesets/basic.xml
+++ /dev/null
@@ -1,375 +0,0 @@
-
-
-
-
-
-
-The Basic Ruleset contains a collection of good practices which everyone should follow.
-
-
-
-
-
- Empty Catch Block finds instances where an exception is caught,
- but nothing is done. In most circumstances, this swallows an exception
- which should either be acted on or reported.
-
-
-
-
- 1]
- [count(*) = 0]
- [../@Finally='false' or following-sibling::Block]
- ]]>
-
-
-
- 3
-
-
-
-
-
-
-
-
- Empty If Statement finds instances where a condition is checked but nothing is done about it.
-
- 3
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Empty While Statement finds all instances where a while statement
- does nothing. If it is a timing loop, then you should use Thread.sleep() for it; if
- it's a while loop that does a lot in the exit expression, rewrite it to make it clearer.
-
-
-
-
-
-
-
-
- 3
-
-
-
-
-
-
-
-
-
- Avoid empty try blocks - what's the point?
-
-
-
-
-
-
-
-
- 3
-
-
-
-
-
-
-
-
- Avoid empty finally blocks - these can be deleted.
-
-
-
-
-
-
-
-
- 3
-
-
-
-
-
-
-
-
-
- Avoid empty switch statements.
-
-
-
-
-
-
-
-
- 3
-
-
-
-
-
-
-
-
-
- Avoid jumbled loop incrementers - it's usually a mistake, and it's confusing even if it's what's intended.
-
-
-
-
-
-
-
-
- 3
-
-
-
-
-
-
-
-
-
- Some for loops can be simplified to while loops - this makes them more concise.
-
-
-
-
- 1][not(ForInit)][not(ForUpdate)]
- ]]>
-
-
-
- 3
-
-
-
-
-
-
-
-
- Avoid unnecessary temporaries when converting primitives to Strings
-
- 3
-
-
-
-
-
-
-
- Override both public boolean Object.equals(Object other), and public int Object.hashCode(), or override neither. Even if you are inheriting a hashCode() from a parent class, consider implementing hashCode and explicitly delegating to your superclass.
-
-
-
-
-
-
-
-
- 3
-
-
-
-
-
-
-
-
- Partially created objects can be returned by the Double Checked Locking pattern when used in Java.
- An optimizing JRE may assign a reference to the baz variable before it creates the object the
- reference is intended to point to. For more details see http://www.javaworld.com/javaworld/jw-02-2001/jw-0209-double.html.
-
- 1
-
-
-
-
-
-
-
-
-
diff --git a/pmd/src/plugin-resources/rulesets/braces.xml b/pmd/src/plugin-resources/rulesets/braces.xml
deleted file mode 100644
index 6dff1ba1..00000000
--- a/pmd/src/plugin-resources/rulesets/braces.xml
+++ /dev/null
@@ -1,146 +0,0 @@
-
-
-
-
-
-
-The Braces Ruleset contains a collection of braces rules.
-
-
-
-
- Avoid using if statements without using curly braces
-
-
-
-
-
-
-
-
- 3
-
-
-
-
-
-
-
-
- Avoid using 'while' statements without using curly braces
-
-
-
-
-
-
-
-
- 3
-
-
-
-
-
-
-
-
- Avoid using if..else statements without using curly braces
-
-
-
-
- 2][not(Statement/Block)]
- ]]>
-
-
-
- 3
-
-
-
-
-
-
-
-
- Avoid using 'for' statements without using curly braces
-
-
-
-
-
-
-
-
- 3
-
-
-
-
-
-
-
-
-
-
diff --git a/pmd/src/plugin-resources/rulesets/codesize.xml b/pmd/src/plugin-resources/rulesets/codesize.xml
deleted file mode 100644
index 0194f8b8..00000000
--- a/pmd/src/plugin-resources/rulesets/codesize.xml
+++ /dev/null
@@ -1,255 +0,0 @@
-
-
-
-
-
-
-The Code Size Ruleset contains a collection of rules that find code size related problems.
-
-
-
-
-
-Excessive Method Length usually means that the method is doing
-too much. There is usually quite a bit of Cut and Paste there
-as well. Try to reduce the method size by creating helper methods,
-and removing cut and paste.
-
-Default value is 2.5 sigma greater than the mean.
-
-NOTE: In version 0.9 and higher, their are three parameters available:
-minimum - Minimum Length before reporting.
-sigma - Std Deviations away from the mean before reporting.
-topscore - The Maximum Number of reports to generate.
-
-At this time, only one can be used at a time.
-
-
- 3
-
-
-
-
-
-
-
-
-
-
-
-
-This checks to make sure that the Parameter Lists in the project aren't
-getting too long. If there are long parameter lists, then that is
-generally indicative that another object is hiding around there.
-
-Basically, try to group the parameters together.
-
-Default value is 2.5 sigma greater than the mean.
-
-NOTE: In version 0.9 and higher, their are three parameters available:
-minimum - Minimum Length before reporting.
-sigma - Std Deviations away from the mean before reporting.
-topscore - The Maximum Number of reports to generate.
-
-At this time, only one can be used at a time.
-
-
- 3
-
-
-
-
-
-
-
-
-
-
-
-
-Long Class files are indications that the class may be trying to
-do too much. Try to break it down, and reduce the size to something
-managable.
-
-Default value is 2.5 sigma greater than the mean.
-
-NOTE: In version 0.9 and higher, their are three parameters available:
-minimum - Minimum Length before reporting.
-sigma - Std Deviations away from the mean before reporting.
-topscore - The Maximum Number of reports to generate.
-
-At this time, only one can be used at a time.
-
-
- 3
-
-
-
-
-
-
-
-
-
-
-
-Complexity is determined by the number of decision points in a method plus one for the
-method entry. The decision points are 'if', 'while', 'for', and 'case labels'. Scale:
-1-4 (low complexity) 5-7 (moderate complexity) 8-10 (high complexity) 10+ (very high complexity)
-
- 3
-
-
-
-
-
-
-
-
-
-
- A large amount of public methods and attributes declared in an object can indicate the class may need
- to be broken up as increased effort will be required to thoroughly test such a class.
-
- 3
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/pmd/src/plugin-resources/rulesets/controversial.xml b/pmd/src/plugin-resources/rulesets/controversial.xml
deleted file mode 100644
index 592bfa77..00000000
--- a/pmd/src/plugin-resources/rulesets/controversial.xml
+++ /dev/null
@@ -1,187 +0,0 @@
-
-
-
-
-
-
-The Controversial Ruleset contains rules that, for whatever reason, are considered controversial. They
-are separated out here to allow people to include as they see fit via custom rulesets. This ruleset was
-initially created in response to discussions over UnnecessaryConstructorRule which Tom likes but
-most people really dislike :-)
-
-
-
-
- Unnecessary constructor detects when a constructor is not necessary; i.e., when there's only one constructor,
- it's public, has an empty body, and takes no arguments.
-
-
-
-
-
-
-
-
- 3
-
-
-
-
-
-
-
-
-
- Assigning a "null" to a variable (outside of its declaration) is usually in
- bad form. Some times, the assignment is an indication that the programmer doesn't
- completely understand what is going on in the code. NOTE: This sort of assignment
- may in rare cases be useful to encourage garbage collection. If that's what you're using
- it for, by all means, disregard this rule :-)
-
- 3
-
-
-
-
-
-
-
- A method should have only one exit point, and that should be the last statement in the method.
-
- 3
-
-
- 0) {
- return "hey"; // oops, multiple exit points!
- }
- return "hi";
- }
- }
- ]]>
-
-
-
-
-
- Unused modifiers are, well, unused.
-
-
-
-
-
-
-
-
- 3
-
-
-
-
-
-
-
- Avoid assigments in operands; this can make code more complicated and harder to read.
-
-
-
-
-
-
-
-
- 3
-
-
-
-
-
-
-
- Each class should declare at least one constructor. Note that this rule is the
- opposite of UnnecessaryConstructorRule, so running them at the same time will
- result on a rule violation on every class.
-
- 3
-
-
-
-
-
-
-
-
-
-
diff --git a/pmd/src/plugin-resources/rulesets/coupling.xml b/pmd/src/plugin-resources/rulesets/coupling.xml
deleted file mode 100644
index 6b6e6521..00000000
--- a/pmd/src/plugin-resources/rulesets/coupling.xml
+++ /dev/null
@@ -1,89 +0,0 @@
-
-
-
-
-
-
- These are new rules for coupling
-
-
-
-
- Rule counts unique attributes, local variables and return types within an object. An amount
- higher than specified threshold can indicate a high degree of couping with in an object
-
- 3
-
-
-
-
-
-
-
-
-
-
- A high number of imports can indicate a high degree of coupling within
- an object. Rule counts the number of unique imports and reports a violation
- if the count is above the user defined threshold.
-
- 3
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/pmd/src/plugin-resources/rulesets/design.xml b/pmd/src/plugin-resources/rulesets/design.xml
deleted file mode 100644
index e0fa063f..00000000
--- a/pmd/src/plugin-resources/rulesets/design.xml
+++ /dev/null
@@ -1,321 +0,0 @@
-
-
-
-
-
-
-The Design Ruleset contains a collection of rules that find questionable designs.
-
-
-
-
-
- If you have a class that has nothing but static methods, consider making it a Singleton
-
- 3
-
-
-
-
-
-
-
-
-
- Avoid using implementation types (i.e., HashSet); use the interface (i.e, Set) instead
-
- 3
-
-
-
-
-
-
-
-
-
-Avoid unnecessary if..then..else statements when returning a boolean
-
- 3
-
-
-
-
-
-
-
-
- Switch statements should have a default label.
-
-
-
-
-
-
-
-
- 3
-
-
-
-
-
-
-
-
-
-
- Deeply nested if..then statements are hard to read.
-
- 3
-
-
-
-
-y) {
- if (y>z) {
- if (z==x) {
- // this is officially out of control now
- }
- }
- }
- }
-}
-]]>
-
-
-
-
-
-
-Reassigning values to parameters is a questionable practice. Use a temporary local variable instead.
-
- 2
-
-
-
-
-
-
-
- A high ratio of statements to labels in a switch statement implies that the switch
- statement is doing too much work. Consider moving the statements either into new
- methods, or creating subclasses based on the switch variable.
-
- 3
-
-
-
-
-
-
-
-
-
-
- Calling overridable methods during construction poses a risk of invoking methods on an
- incompletely constructed object. This situation can be difficult to discern.
- It may leave the sub-class unable to construct its superclass or forced to
- replicate the construction process completely within itself, losing the ability to call
- super(). If the default constructor contains a call to an overridable method,
- the subclass may be completely uninstantiable.
-
- 1
-
-
-
-
-
-
-
- Instantiation by way of private constructors from outside of the constructor's class often causes the generation of an accessor.
- A factory method, or non-privitization of the constructor can eliminate this situation.
- The generated class file is actually an interface. It gives the accessing class the ability to invoke a new hidden package
- scope constructor that takes the interface as a supplementary parameter. This turns a private constructor effectively into
- one with package scope, though not visible to the naked eye.
-
- 3
-
-
-
-
-
-
diff --git a/pmd/src/plugin-resources/rulesets/experimental.xml b/pmd/src/plugin-resources/rulesets/experimental.xml
deleted file mode 100644
index 9015c566..00000000
--- a/pmd/src/plugin-resources/rulesets/experimental.xml
+++ /dev/null
@@ -1,108 +0,0 @@
-
-
-
-
-
-
-This is the sandbox.
-
-
-
-
-
-
-
diff --git a/pmd/src/plugin-resources/rulesets/favorites.xml b/pmd/src/plugin-resources/rulesets/favorites.xml
deleted file mode 100644
index e7ce55c5..00000000
--- a/pmd/src/plugin-resources/rulesets/favorites.xml
+++ /dev/null
@@ -1,42 +0,0 @@
-
-
-
-
-
-
-The Favorites ruleset contains links to rules that I like to use. Usually I
-combine this ruleset with the unusedcode.xml, basic.xml, and import.xml rulesets for my projects.
-This ruleset also serves as an example of do a custom ruleset.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/pmd/src/plugin-resources/rulesets/imports.xml b/pmd/src/plugin-resources/rulesets/imports.xml
deleted file mode 100644
index 853d9608..00000000
--- a/pmd/src/plugin-resources/rulesets/imports.xml
+++ /dev/null
@@ -1,124 +0,0 @@
-
-
-
-
-
-
-These rules deal with different problems that can occur with a class' import statements.
-
-
-
-
- Avoid duplicate import statements.
-
- 4
-
-
-
-
-
-
-
-
- Avoid importing anything from the package 'java.lang'. These classes are automatically imported (JLS 7.5.3).
-
-
-
-
-
-
-
-
- 4
-
-
-
-
-
-
-
-
- Avoid unused import statements.
-
- 4
-
-
-
-
-
-
-
-
- No need to import a type that's in the same package.
-
- 3
-
-
-
-
-
-
-
-
-
diff --git a/pmd/src/plugin-resources/rulesets/junit.xml b/pmd/src/plugin-resources/rulesets/junit.xml
deleted file mode 100644
index 1ffe47f3..00000000
--- a/pmd/src/plugin-resources/rulesets/junit.xml
+++ /dev/null
@@ -1,110 +0,0 @@
-
-
-
-
-
-
-These rules deal with different problems that can occur with JUnit tests.
-
-
-
-
- The suite() method in a JUnit test needs to be both public and static.
-
-
-
-
-
-
-
-
- 3
-
-
-
-
-
-
-
-
-
- Some JUnit framework methods are easy to misspell.
-
-
-
-
-
-
-
-
- 3
-
-
-
-
-
-
-
-
- JUnit assertions should include a message - i.e., use the three argument version of
- assertEquals(), not the two argument version.
-
- 3
-
-
-
-
-
-
-
-
-
-
-
diff --git a/pmd/src/plugin-resources/rulesets/naming.xml b/pmd/src/plugin-resources/rulesets/naming.xml
deleted file mode 100644
index ea4e50f1..00000000
--- a/pmd/src/plugin-resources/rulesets/naming.xml
+++ /dev/null
@@ -1,124 +0,0 @@
-
-
-
-
-
-
-The Naming Ruleset contains a collection of rules about names - too long, too short, and so forth.
-
-
-
-
-
-Detects when a field, local or parameter has a short name.
-
-
-
-
-
-
-
-
- 3
-
-
-
-
-
-
-
-Detects when a field, formal or local variable is declared with a big name.
-
- 3
-
-
-
- 12]
- ]]>
-
-
-
-
-
-
-
-
-
-
-Detects when very short method names are used.
-
- 3
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/pmd/src/plugin-resources/rulesets/newrules.xml b/pmd/src/plugin-resources/rulesets/newrules.xml
deleted file mode 100644
index 54a1df82..00000000
--- a/pmd/src/plugin-resources/rulesets/newrules.xml
+++ /dev/null
@@ -1,49 +0,0 @@
-
-
-
-
-
-
-These are new rules for the next release
-
-
-
-
-
-
- asdsad
-
- 3
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/pmd/src/plugin-resources/rulesets/strings.xml b/pmd/src/plugin-resources/rulesets/strings.xml
deleted file mode 100644
index 79cc9438..00000000
--- a/pmd/src/plugin-resources/rulesets/strings.xml
+++ /dev/null
@@ -1,101 +0,0 @@
-
-
-
-
-
-
-These rules deal with different problems that can occur with String manipulation.
-
-
-
-
-
- Avoid instantiating String objects; this is usually unnecessary.
-
-
-
-
-
-
-
-
- 2
-
-
-
-
-
-
-
-
-Code containing duplicate String literals can usually be improved by declaring the String as a constant field.
-
- 3
-
-
-
-
-
-
-
-
-
-
- Avoid calling toString() on String objects; this is unnecessary
-
- 3
-
-
-
-
-
-
-
-
-
-
diff --git a/pmd/src/plugin-resources/rulesets/unusedcode.xml b/pmd/src/plugin-resources/rulesets/unusedcode.xml
deleted file mode 100644
index ebdcb538..00000000
--- a/pmd/src/plugin-resources/rulesets/unusedcode.xml
+++ /dev/null
@@ -1,111 +0,0 @@
-
-
-
-
-
-
-The Unused Code Ruleset contains a collection of rules that find unused code.
-
-
-
-
-Unused Private Field detects when a private field is declared
-that is not used by the class.
-
- 3
-
-
-
-
-
-
-
-Unused Local Variables detects when a variable is declared, but not
-used (except for possibly initial assignment)
-
- 3
-
-
-
-
-
-
-
-
-
-
-Unused Private Method detects when a private method is declared but is unused.
-
- 3
-
-
-
-
-
-
-
-
-Avoid passing parameters to methods and then not using those parameters.
-
- 3
-
-
-
-
-
-
-
-
-
-
-
diff --git a/pmd/xdocs/changes.xml b/pmd/xdocs/changes.xml
index 5d192694..856d6fcf 100644
--- a/pmd/xdocs/changes.xml
+++ b/pmd/xdocs/changes.xml
@@ -25,6 +25,11 @@
Vincent Massol
+
+
+ Upgrade to PMD 1.3, clean up and improve documentation.
+
+ Create directories that exist under maven.build.dir before using them so it works after clean.Fix usage of the maven.pmd.cpd.enable property so it is disabled when set to false (the default)
diff --git a/pmd/xdocs/faq.fml b/pmd/xdocs/faq.fml
new file mode 100644
index 00000000..7508bbd7
--- /dev/null
+++ b/pmd/xdocs/faq.fml
@@ -0,0 +1,306 @@
+
+
+
+
+ General
+
+
+
+ What is PMD?
+
+
+
According to the official website (
+ pmd.sourceforge.net ),
+ PMD scans Java source code and looks for potential problems like:
+
+
+
+
Unused local variables
+
Empty catch blocks
+
Unused parameters
+
Empty 'if' statements
+
Duplicate import statements
+
Unused private methods
+
Classes which could be Singletons
+
Short/long variable and method names
+
+
+
This plugin provides a means to integrate the pmd report into the
+ maven process.
+
+
+
+
+
+
+ Installation
+
+
+
+ How do I install the maven-pmd-plugin?
+
+
+
+ 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 Basic Usage for examples on how to use it.
+
+
+
+
+
+
+ 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?
+
+
+
+ Starting with the
+ maven-plugin-plugin 1.2 (which first appeared with
+ maven 1.0-rc1), you issue the following command to maven to
+ download the version of your choice.
+
+
+
+
+
+ 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.
+
+
+
+
+
+
+
+ Usage
+
+
+
+ How do I use it?
+
+
+
+ The quickest, and easiest way to use the maven-pmd-plugin is to
+ add the maven-pmd-plugin entry to your
+
+ reports section in your project's project.xml
+
+ project descriptor.
+
+
+
+
+ ...
+ maven-pmd-plugin
+ ...
+
+]]>
+
+
+
+
+
+
+ I don't want to use it via the project.xml. What are my options?
+
+
+
+ The PMD plugin can be started through "maven pmd"
+ or integrated by using the following code snippet in
+ maven.xml:
+
+
+
+
+
+
+
+]]>
+
+
+
+ The generated report has to be added manually to the
+ website which is usually done with navigation.xml.
+
+
+
+
+
+]]>
+
+
+
+
+
+
+ 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?
+
+
+
+ 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 maven.pmd.enable=false into your
+ project properties for that one sub-project.
+
+
+
+
+
+
+ How do I disable certain files from being checked by the
+ maven-pmd-plugin?
+
+
+
+ The maven-pmd-plugin will scan all *.java files in
+ your defined <sourceDirectory> path
+ specified in your
+ project descriptor.
+
+
+ Use the maven.pmd.excludes property to exclude
+ certain files from being checked by the maven-pmd-plugin.
+
+
+ Lets assume that you have generated a DB layer within your project.
+ Simply put maven.pmd.excludes=**/database/** into your
+ project.properties file to exclude the files in your
+ database directory and below.
+
+
+
+
+
+
+ How do I get rid of these zillions of rule violations?
+
+
+
+ You could fix the rule violations.
+
+
+ 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.
+
+
+ There are two ways to accomplish this.
+
+
+
+ Define which default pmd rulesets you want to use in the
+ maven.pmd.rulesetfiles property.
+
+
+
+ The default setting for the maven.pmd.rulesetfiles
+ property is:
+
+
+
+
+
+ The following list of default pmd rulesets was obtained from
+ the official pmd
+ project page.
+
+ Define a custom ruleset.xml and reference it via the
+ maven.pmd.rulesetfiles property.
+
+
+ Example of a custom ruleset, saved as file called
+ favorite-pmd.xml in your project root.
+
+
+
+
+
+ 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.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+]]>
+
+
+
+ How it's referenced in your project.properties
+ file.
+
+
+
+
+
+
+
+
+
+
+
+
+ How do I manually upgrade to a newer PMD jar?
+
+
+
+ The JAR picked up the plugin is defined in
+ $MAVEN_HOME/plugins/pmd/project.xml and can be
+ changed.
+
- Usually I provide a custom plugin, e.g. "maven-it20one-plugin-1.0"
- which sets the variable "maven.pmd.enable" to "true". Since all
- plugins are parsed it is guaranteed that PMD will be executed
-
-
- The simple way is to define the property in
- $MAVEN_HOME/bin/driver.properties
-
-
-
-
-
- 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 "maven.pmd.enable=false" into your project properties.
-
-
-
-
-
- Also assuming that you have generated a DB layer within your project.
- Simply put "maven.pmd.excludes=**/database/**" into your project
- properties.
-
-
-
-
-
- You could fix the rule violations. On the other hand I find
- some of the rules quite annoying. Rules can be removed by editing
- the rulesets.properties.
-
-
- In other case you change the trigger of the rules directly in the
- ruleset files to fine tune the reports.
-
-
-
-
-
- "Those bloody contributors do not keep up with the
- release - there is the new JAR out there for two
- days and no update of the plugin ... having pizza,
- coke, a joint and doing nothing" - Fine, as
- long as we do not inhale ... ;-)
-
-
- The JAR picked up the plugin is defined in
- $MAVEN_HOME/plugins/pmd/project.xml and can be
- changed.
-
-
- Leave it, try it but don't whine will I have to carve
- out a living with some paid work ... :-[]
-
-
-
-
-
-
-
-
diff --git a/pmd/xdocs/index.xml b/pmd/xdocs/index.xml
index 6eec124c..7b1c1363 100644
--- a/pmd/xdocs/index.xml
+++ b/pmd/xdocs/index.xml
@@ -32,79 +32,11 @@
This plugin generates a report of the PMD static source code
analyzer.
+
+
+ See the FAQ for more information on Installation / Use / Configuring.
+
-
-
-
- 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
-
-
-
- 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.
-
-
-
- Run "maven -g" and look out for documented PMD goals.
- If you see some then the unpacking succeeded.
-
-
-
- The PMD plugin can be started through "maven pmd"
- or integrated by using the following code snippet in
- maven.xml:
-
-
-
-
-
-
-
-]]>
-
-
-
- The generated report has to be added manually to the
- website which is usually done with navigation.xml.
-
-
-
-
-
-]]>
-
-
-
- Another way to integrate the PMD plugin is to add it to the <reports>
- section in your project.xml:
-