开发者

problems using PMD in IntelliJ IDEA

开发者 https://www.devze.com 2023-03-03 13:12 出处:网络
I was trying to install the PMD plugin to my IntelliJ IDE. I have followed the instructions but when trying to run the pmd check I am getting the following exception. From what it seems the “.” Is b

I was trying to install the PMD plugin to my IntelliJ IDE. I have followed the instructions but when trying to run the pmd check I am getting the following exception. From what it seems the “.” Is being parsed as a / which produce a wrong file name for the class loader.

Meaning the path: Even though the settings are

-cp %CLASSPATH%; C:/Development/IDE/Utils/PMDPlugin/lib/pmd-4.2.5.jar; C:\Development\IDE\Utils\PMDPlugin\lib\asm-3.1.jar; C:\Development\IDE\Utils\PMDPlugin\lib\jaxen-1.1.1.jar net.sourceforge.pmd.PMD "$FilePath$" ideaj unusedcode,imports "$Sourcepath$" $FileClass$.method $FileName$

From some reason it is still looking for C:/Development/IDE/Utils/PMDPlugin/lib/pmd-4/2/5/jar

Here is the exception:

java.lang.NoClassDefFoundError: C:/Development/IDE/Utils/PMDPlugin/lib/pmd-4/2/5/jar;
Caused by: java.lang.ClassNotFoundException: C:.Development.IDE.Utils.PMDPlugin.lib.pmd-4.2.5.jar;
    at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
    at java.lang.C开发者_StackOverflowlassLoader.loadClass(ClassLoader.java:248)
Could not find the main class: C:/Development/IDE/Utils/PMDPlugin/lib/pmd-4.2.5.jar;.  Program will exit.
Exception in thread "main"

I am using Intelli IDEA 10.0.3 Build #IC 103.288 built on April 2011 JDK 1.6.0_21

Do you have any advices?? Thanks


Looks like you have spaces between your CLASSPATH entries. That won't do; remove them.

UPDATE:

I downloaded PMD and managed to make it run. I followed the directions that you posted, replacing the path to PMD with my own. I'd recommend not using a path that has spaces in it.

The one thing that was balky was %JAVA_HOME%, so I replaced it with the hard-wired path to my Java /bin. Once I did that, all was well.

I'd ask why you think PMD is better than the inspector tools built into IntelliJ? I'd rather check boxes to set rules than have to do all the nonsense that PMD requires.

Once I was satisfied that I could make it work I deleted it. I'd rather run Inspector.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号