Search code examples
intellij-ideapmd

PMD working inside intellij as an External Tool


I would like to make it so that I can Run a PMD check as an external tool from withing intellij 14.x

The only documentation I can find is old and outdated based on pmd 4.x. How do I get it working correctly? Is anyone out there using PMD as an external Tool? I tried downloading the built in PMD plugin but when I pointed it to my custom_pmd_ruleset.xml it ignored it entirely --> perhaps the plugin is broken.


Solution

  • After a fair bit of research, here's what worked for me: enter image description here

    And here's the classpath part that's super long and cut off in the image:

    -cp "C:\Users\nate\.m2\repository\commons-io\commons-io\2.4\commons-io-2.4.jar;C:\Users\nate\.m2\repository\org\apache\commons\commons-lang3\3.3.2\commons-lang3-3.3.2.jar;C:\Users\nate\.m2\repository\net\sourceforge\pmd\pmd-core\5.3.2\pmd-core-5.3.2.jar;C:\Users\nate\.m2\repository\net\sourceforge\pmd\pmd-java\5.3.2\pmd-java-5.3.2.jar;C:\Users\nate\.m2\repository\asm\asm\3.1\asm-3.1.jar;C:\Users\nate\.m2\repository\jaxen\jaxen\1.1.1\jaxen-1.1.1.jar;C:\Users\nate\.m2\repository\com\beust\jcommander\1.48\jcommander-1.48.jar" net.sourceforge.pmd.PMD -R "$ModuleFileDir$\src\test\resources\custom-pmd-rules.xml" -d "$FileDirRelativeToProjectRoot$/$FileName$"
    

    Hopefully that saves someone some time getting it working. Enjoy.