在 IntelliJ IDEA 中使用 PMD 的问题

发布于 2024-11-05 16:57:14 字数 1423 浏览 0 评论 0原文

我试图将 PMD 插件安装到我的 IntelliJ IDE 中。我已按照说明进行操作,但在尝试运行 pmd 检查时出现以下异常。从看来“。”被解析为 / ,这会为类加载器生成错误的文件名。

含义路径:即使设置

-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$

出于某种原因,它仍在寻找 C:/Development/IDE/Utils/PMDPlugin/lib/pmd-4/2/5/jar

这是例外:

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.ClassLoader.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"

我正在使用 Intelli IDEA 10.0 .3 构建 #IC 103.288 构建于 2011 年 4 月 JDK 1.6.0_21

你有什么建议吗?谢谢

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.ClassLoader.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

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

肩上的翅膀 2024-11-12 16:57:14

看起来您的 CLASSPATH 条目之间有空格。那不行;删除它们。

更新:

我下载了 PMD 并设法让它运行。我按照您发布的说明进行操作,将 PMD 的路径替换为我自己的路径。我建议不要使用其中有空格的路径。

唯一的问题是 %JAVA_HOME%,因此我将其替换为 Java /bin 的硬连线路径。一旦我这样做了,一切都很好。

我想问为什么你认为 PMD 比 IntelliJ 内置的检查器工具更好?我宁愿勾选复选框来设置规则,也不愿做 PMD 要求的所有废话。

一旦我确信我可以让它工作,我就把它删除了。我宁愿运行督察。

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文