Login | Register   
Twitter
RSS Feed
Download our iPhone app
TODAY'S HEADLINES  |   ARTICLE ARCHIVE  |   FORUMS  |   TIP BANK
Browse DevX
Sign up for e-mail newsletters from DevX


advertisement
 

PMD Squashes Code Bugs : Page 2

Despite being among the most effective ways of finding defects and improving code quality, code reviews are rarely done with any consistency. Enter PMD, a static analysis tool that can make reviewing code easier and more fun.


advertisement

Using PMD with Eclipse

PMD is designed to integrate well into a developer's work environment. Plug-ins exist for the principal IDEs, and they are the most productive and convenient way for a developer to use PMD. Plug-ins allow almost real-time code verification—they raise issues whenever you save the source code (see Figure 1).

Click to enlarge
Figure 1. The PMD Plug-In in Eclipse

Installing PMD
Click to enlarge
Figure 2. Setting Up a New Remote Site



The easiest way to install and use PMD under Eclipse is to use the remote update site. From Eclipse, take the following steps:

  1. Open the Help->Software Updates->Find and Install menu.
  2. Click Next, and choose New Remote Site.
  3. Now enter the URL of the remote site (http://pmd.sf.net/eclipse), and an appropriate name such as "PMD" (see Figure 2).
  4. Click to enlarge
    Figure 3. Installing from the Remote Site
  5. Now you should have a brand new remote site in your "Update Sites to visit" window (see Figure 3). Make sure you have the PMD site checked in the "Sites to include in search" window, and click Finish. Then just go through the installation screens to install the plug-in.

Click to enlarge
Figure 4. Activating PMD in a Project

The plug-in should now be correctly installed. Restart Eclipse if you are asked to. Once that's done, you can set up your projects to use PMD.

Configuring PMD in a Project
You now need to activate PMD for your project. Open the project properties window (Project->Properties). You will now have a PMD entry (see Figure 4). This window allows you to configure PMD in detail for your particular project. For now, just check the "Enable PMD" box.



Comment and Contribute

 

 

 

 

 


(Maximum characters: 1200). You have 1200 characters left.

 

 

Sitemap