Technical

How to Install PMD plugin for Eclipse IDE?

To install the PMD plugin for Eclipse IDE, you need to follow the steps given below:

  1. Start Eclipse IDE and open up a project
  2. Select the main tab Help and then select Software Updates and then finally select Find and Install.
  3. Click on Next and then click on New remote site.
  4. Enter a meaningful name as like PMD into the Name field and this link (http://sourceforge.net/projects/pmd/files/pmd-eclipse/update-site) into the URL field
  5. From here on, you can just click through the rest of the dialog boxes to be able to install the plugin

If the above process doesn’t work for you, then you can alternatively download the latest zip file from the PMD – Source-forge site (https://sourceforge.net/projects/pmd/files/ ) and follow the process given above except for using New local site but to browse to the downloaded zip file.

How to import a Custom PMD Rules set?

 You should be able to import those rules into your Eclipse IDE by following the steps given below:

  1. Go to the main tab Window and then click on Preferences.
  2. Go to the tab PMD and then to Rules configuration in the tree structure that you find.
  3. Click on Clear all to remove any default rule set that comes along with PMD plugin.
  4. Click on Import rule set and then import your rule set that’s been provided to you by your company or client, but be sure to select the option Import by copy.

It would take a little while for your IDE, to process these new rules set that you’ve imported into the IDE. You might be getting an In Progress screen when you close the Preferences screen.

 How to check code with PMD?

To run the newly installed PMD plugin, give any of your project nodes a right click and check for PMD sub menu item on the right-click. Click on it to open up a sub-sub-menu, from which you will have to select the option Check code with PMD.

If you’re not able to see the raised PMD violations then you should be able to see them when you traverse through the following menus on your IDE. Firstly go on to Window menu and then click on Show View to select Others and then to select PMD and finally to select Violations Overview.

You will be able to select or unselect the buttons to show the PMD violations as per the PMD alert priority. Hope that this article helps you get started with PMD on eclipse IDE.

Comment here

This site uses Akismet to reduce spam. Learn how your comment data is processed.