Article Index

Installing PMD in Eclipse

  1. Start Eclipse.
  2. Start the installation procedure : select the Help>Software Updates>Find and Install... menu item.
  3. Select "Search for new features to install" option and click Next.
  4. Click New Remote Site...
  5. Give a name (ie PMD Eclipse Site), enter the URL&160;
  6. Select this new site in the Sites to include in search list and click Next.
  7. Select PMD for Eclipse 3 and Apache Xerces in the "Select the features to install" list and click Next.
  8. Accept the terms of the license agreements and click Next.
  9. Verify that the install location is your Eclipse installation directory, otherwise select the correct one, click Finish.
  10. A warning appear telling the feature is not signed. Ignore and click Install to continue.
  11. Accept to restart the workbench to load PMD into the workbench.

Eclipse is restarted and a PMD welcome page is displayed : the plugin is correctly installed.

Using PMD in Eclipse

Trying to start PMD on a full workspace on too many modules/projects is very dangerous as the number of
violations can be very high (many thousands) and can make eclipse run out of memory

In order to test PMD. I did choose an open source project, the connector of MySQL 5 in the version 5.1.6.
I do not want to judge the quality of MySQL connector, this is simply a project code that was available on my desktop.

First Review all rules, you will find some of them disturbing (remember nobody like to be told that his coding habit
are bad), You can switch off some rules or import a set of predefined rules in the preferences windows


If you are in a distributed team, or wan to share your settings using either CVS or Subversion (SVN) don't
forget to export the rule sets to a share project.

The code duplicator detector will report any code that seems to be identical according to a certain value of
number of line (25 lines of duplicated code)


The project is set in eclipse, and compiling


Lets run PMD on MySQL connector,
The project is after no more compiling....

PMD.code.checker2 PMD.code.checker4png

PMD create additional Eclipse views, this help you better judge how many violations there is and their
level. As You see there is some violations