Installation

Download the latest version of the plugin from the project downloads page.

Activation

Once installed, there are two things that you need to do to run PMD on your project. First, toggle the pmd nature of a project. (Tip: see the customization section before adding the PMD nature)This action modifies the project descriptor, and adds the pmd nature and the pmd builder (which is responsible of actually running pmd).
The second thing that you need to do, enabling the problems view to show you the PMD problems, go to the problems view, click on the menu and go to filters. You shuold be able  (search 'show problems of type') to check pmd problem there. The view now should include the pmd problems found in a file.

Customization

By default, all rulesets are applied to the project, notice that this generally takes pretty much time and is not the most common use. The plugin will search a file called .pmd.xml in the project root. is this file is present, it will be used as the only ruleset applied to the project.
For more information about how to write this file see here.
In this .pmd.xml ruleset you can define references to standard rulesets, as well as changing some properties of these rules. Also you can specify your own xpath based rules.

NOTE: at this moment you can't (easily) add your own java-based rules (this is: custom rules written in java), this is due to the missing classpath specification for the rule. You'd need specify the classpath in the plugin so you can add custom rules here. A future version of the plugin may provide this functionallity.

Features

You can find here the property file that defined which rules have quick fixes implemented.


FAQ

How do I navigate problems with keys?
Use the dropdown of next annotation button, and check PMD problem there. This will let you use that button, or the next/prev hotkey associated to navigate violations.

Quick Fix All

A new feature has been added since 1.4. It'a project context menu action that attempts to run the quick fix to all pmd problems reported in a project. If the problem has no quick fix, or has more than one, no action is performed. If the problem has only one quick fix, then, it is applied as if the use has clicked quick fix manually.

SourceForge.net Logo