A general note - most plugins include the PMD jar files, which has the rulesetsinside it. So even though the rulesets parameter that some pluginsuse (i.e., “category/java/bestpractices.xml”) looks like a filesystem reference, it’s reallybeing used by a getResourceAsStream() call to load it out of the PMD jar files.
Status column:
BlueJ is a teaching IDE. To install the PMD extension for BlueJ, downloadthePMDExecExt.jar fileand place it in yourbluej/lib/extensions/ directory.
To install the PMD plugin for Eclipse:
Alternatively, you can download the latest zip file and follow the above proceduresexcept 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 andselect “PMD”->”Find suspect cut and paste”. The report will be placed in a “reports” directoryin a file called “cpd-report.txt”.
To find additional help for other features, please read included help by selectingHelp->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, lookunder the menu headings Java -> Compiler -> Errors/Warnings -> Annotations -> Unhandled Warning Token.
Integration with GNU Emacs is performed through an ELisp package, pmd.el.It supports two commands, “pmd-current-buffer” and “pmd-current-dir”.The output is captured in a compilation buffer which allows the user to “jump”directly to the source code position associated with the PMD warnings.
You can use an integrated plugin or just use it as an IDEA “External Tool”.
Here’s how to set it up as an “External Tool”:
c:\pmd\bin\pmd.bat-d "$FilePath$" -f ideaj -R rulesets/java/quickstart.xml -P sourcePath="$Sourcepath$" -P classAndMethodName=$FileClass$.method -P fileName=$FileName$That’s pretty much it. Now you can right click on a source directory and select PMD,it’ll run recursively on the source files, and the results shouldbe displayed in a window and hyperlinked into the correct file and line of code. I usuallyright-click on the message window title bar and unselect “autohide” so the window doesn’t goaway every time I fix something in the code window.
QAPlug is an Intellij IDEA plugin to manage code quality. It integrates no less than Checkstyle, FindBugs, and PMD.
The plugin is available athttps://qaplug.com/.
Also available at the JetBrains site,QAPlug-PMDandQAPlug.
To install the PMD plugin for JDeveloper:
To run the PMD plugin for JDeveloper:
The way I use the JEdit plugin is:
Note that you can select individual rules by going to Utilities->Global Options->Plugin Options->PMD.Also, you can change the plugin to prompt you for a directory to check by going to that same menu andselecting the “Ask for Directory” checkbox.
Assumptions
D:\java\jdk\_142\. This means thatD:\java\jdk\_142\bin\java.exe exists.D:\java\pmd-bin-\.This means thatD:\java\pmd-bin-\lib\pmd-.jar (among other jar filesin the same directory) exist.To integrate into TextPad
D:\java\jdk_142\bin\java.exe and click theOpen button. In the center pane of the Preferences dialog,an item “Java” has now been added, and is currently selected.+’ directly to its left.-classpath D:\java\pmd-bin-\lib\pmd-.jar;D:\java\pmd-bin-\lib\asm-3.2.jar;D:\java\pmd-bin-\lib\jaxen-1.1.1.jar net.sourceforge.pmd.PMD -d <i><b>$FileDir</b></i> -f net.sourceforge.pmd.renderers.TextPadRenderer -R E:\directory\my_pmd_ruleset.xml -debug$FileDirCheckedChecked^\([^(]+\)(\([0-9]+\),12$FileDir’ with ‘$File’,in the Parameters textbox.E:\directory\my_pmd_ruleset.xml’with the ruleset of your choice. For example,basic.Ctrl+Page UpCtrl+Page DownTo run PMD against a single Java file
Ctrl+Page Down. This opens an empty, read-only text document (titled “Command Results”).When PMD completes its analysis, this document will be populated with a listing of violated rules(or “Command completed successfully” indicating no violations).To run PMD against a directory of Java files
Ctrl+Page Up. This opens an empty, read-only text document (titled “Command Results”).When PMD completes its analysis, this document will be populated with a listing of violated rules(or “Command completed successfully” indicating no violations).Because directory analysis may take a while, you may choose to cancel this operation. Do so by closingthe (blank Command Results) document, and then confirming that, “yes, I do really want to exit the tool”.
These are integrations that are no longer maintained or for IDEs that no longer exist.
CodeGuide was a Java IDE by omnicore:https://web.archive.org/web/20081210063520/http://www.omnicore.com:80/en/codeguide.htm
Gel was once an IDE:https://archive.org/details/tucows_246670_Gel
Source code for the PMD plugin is here:https://github.com/pmd/pmd-misc/tree/main/pmd-gel/
Here’s how to set up the Gel plugin:
That’s pretty much it. Now you can open a Java project and click on Plugins->PMD anda configuration panel will pop up. You can pick which ruleset you want to run andyou can also pick whether you want to run PMD on the current file or on everysource file in your project.
Was once a IDE by Borland (later Embarcadero): seehttps://en.wikipedia.org/wiki/JBuilder andhttps://web.archive.org/web/20090228184200/http://www.embarcadero.com/products/jbuilder/
Source code for the plugin is here:https://github.com/pmd/pmd-misc/tree/main/pmd-jbuilder/
To enable this OpenTool in JBuilder:
jbuilder/lib/ext/ directoryWhat you can do:
When running PMD, the results will be displayed in the MessageView under a tab called PMD Results. If you click on aviolation message within this view, you will be taken to the line in the source code where the violation was detected.
Things still to do:
Was once a IDE:https://web.archive.org/web/20211018201200/http://www.jcreator.com/
To run PMD on a project, just pick pmd from the Tools menu.
That’s a plugin for an old version of Bea WebLogic Workshop 8.1.x (which is now available from Oracle).The new versions are based on Eclipse and don’t require this plugin anymore.
Please seethe WebLogic Workshop plugin project home page for more information.