Saturday, June 11, 2011

Java Power Tools

This is a very fast brief on how to get and install the most important , in my own opinion,  java power tools you will use in your every-day development activities.

PMD 

To install the PMD plugin for Eclipse:
  • Start Eclipse and open a project
  • Select "Help">"Software Updates">"Find and Install"
  • Click "Next", then click "New remote site"
  • Enter "PMD" into the Name field and "http://pmd.sf.net/eclipse" into the URL field
  • Click through the rest of the dialog boxes to install the plugin
Alternatively, you can download the latest zip file and follow the above procedures except for using "New local site" and browsing to the downloaded zip file.

To configure PMD, select "Windows">"Preferences", then select PMD.

To run PMD, right-click on a project node and select "PMD">"Check code with PMD".

To run the duplicate code detector, right-click on a project node and select "PMD">"Find suspect cut and paste". The report will be placed in a "reports" directory in a file called "cpd-report.txt".

To find additional help for other features, please read included help by selecting Help>Help Contents and browse the "How to..." section in the "PMD Plugin Documentation" book.

After installing an update, if you get an Exception such as "java.lang.RuntimeException: Couldn't find that class xxxxx", try deleting the ruleset.xml file in the .metadata/plugins/net.sourceforge.pmd.eclipse directory in your workspace.

To get Eclipse to not flag the @SuppressWarnings("PMD") annotation, look under the menu headings Java > Compiler > Errors/Warnings > Annotations > Unhandled Warning Token.

Source :http://pmd.sourceforge.net/integrations.html#eclipse


CheckStyle

The recommended way to install the Eclipse Checkstyle Plug-in on Eclipse 3.2/3.3 is via the update site.
  • Within Eclipse go to Help>Software Updates>Find and Install
  • Choose Search for new features to install and press Next
  • Create a New Remote Site...
  • Input a name to your liking (for instance Checkstyle Plug-in) and input the following URL: http://eclipse-cs.sf.net/update/
  • Click your way through the following pages to install the plug-in.
  • Restart Eclipse
  • Copy the ruleset xml file to your project's root directory.
  • Go to Window > Preferences > CheckStyle.
  • Click on New and configure as shown below. Click on browse to find the your ruleset file.
  • You should see something like the following picture.
  • Click OK to accept it.

Note: Alternatively the Checkstyle Eclipse Plug-in can be downloaded from the Eclipse Checkstyle Plug-in's SourceForge project download site.

Source: http://eclipse-cs.sourceforge.net/downloads.html


FindBugs

Update sites allow you to automatically install FindBugs into Eclipse and also query and install updates. There are three different update sites

FindBugs Eclipse update sites
Site Description
http://findbugs.cs.umd.edu/eclipse/ Only provides official releases of FindBugs.
http://findbugs.cs.umd.edu/eclips-candidate/ Provides official releases and release candidates of FindBugs.
http://findbugs.cs.umd.edu/eclipse-daily/ Provides the daily build of FindBugs. No testing other than that it compiles.

You can also manually download the plugin from the following link: http://prdownloads.sourceforge.net/findbugs/edu.umd.cs.findbugs.plugin.eclipse_1.3.9.20090821.zip?download. Extract it in Eclipse's "plugins" subdirectory. (So /plugins/edu.umd.cs.findbugs.plugin.eclipse_1.3.9.20090821/findbugs.png should be the path to the FindBugs logo.)

Once the plugin is extracted, start Eclipse and choose Help → About Eclipse Platform → Plug-in Details. You should find a plugin called "FindBugs Plug-in" provided by "FindBugs Project".

Source: http://findbugs.sourceforge.net/manual/eclipse.htm

No comments:

Post a Comment