##### Overview

- Download PMD 4.2.5
- What's new in PMD 4.2.5
- PMD in the news
- PMD-related products and books
- Best practices
- Future directions
- Similar projects
- Credits
- License
- What does 'PMD' mean?

##### Usage

- Installation
- Command line usage
- Ant task usage
- Maven plugin usage
- Mvn plugin usage
- IDE plugin usage
- Suppressing warnings
- Finding duplicated code
- JSP support

##### Customizing PMD

- Compiling PMD
- How to write a rule
- Writing XPath rules
- How to make a rule set
- How it works
- Rule guidelines

##### For example

- Run PMD on a Sourceforge project

##### Rule Sets

- Index
- Android
- Basic
- Braces
- Code Size
- Clone
- Controversial
- Coupling
- Design
- Finalizers
- Import Statements
- J2EE
- Javabeans
- JUnit Tests
- Logging (Java)
- Logging (Jakarta)
- Migrating
- Naming
- Optimizations
- Strict Exceptions
- Strings
- Sun Security
- Unused Code
- Java Server Pages
- Java Server Faces

##### Project Documentation

- About
- Project Info
- Project Reports
- Development Process

##### Legend

- External Link
- Opens in a new window

## Maven 1 PMD plugin

This page is about the maven 1 PMD plugin. The maven 2 PMD plugin page is available here.

## Running the pmd plugin

### report

To include the Maven report in the project reports section add the following line under the reports element in your project.xml:

    <report>maven-pmd-plugin</report>

This will add an entry to the 'project reports' section with the PMD report.

### manual

To run PMD on a Maven project without adding it as a report, simply run

    maven pmd xdoc

The PMD plugin writes the report in XML which will then be formatted into more readable HTML.

## Customization

### Changing rulesets

To specify a set of official, built-in rulesets to be used set them in the property maven.pmd.rulesets. You can include this setting in your project.properties file.

A clean strategy for customizing which rules to use for a project is to write a ruleset file. In this file you can define which rules to use, add custom rules, and customizing which rules to include/exclude from official rulesets. More information on writing a ruleset can be found here.

Add to the root of your Maven project a pmd.xml file which contains the ruleset mentioned in the previous paragraph. Add the following property to your project now:

    maven.pmd.rulesetfiles = ${basedir}/pmd.xml

## Reference

See the PMD plugin project page here: http://maven.apache.org/maven-1.x/plugins/pmd/