Maven PMD Plugin How To

How to enable PMD for all of my projects?

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

How to disable PMD for one project?

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.

How to disable PMD for certain files?

Also assuming that you have generated a DB layer within your project. Simply put "maven.pmd.excludes=**/database/**" into your project properties.

How to get rid of zillions of rule violations?

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.

How to upgrade to a newer PMD jar?

"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 ... :-[]