[英]Ant can't find Objectweb asm class files when running PMD
I'm trying to use Ant to run PMD, but it tells me that it can't find the Objectweb asm classes. 我正在尝试使用Ant运行PMD,但它告诉我找不到Objectweb asm类。 Specifically:
特别:
build.xml:526: java.lang.NoClassDefFoundError: org/objectweb/asm/ClassVisitor
build.xml:526:java.lang.NoClassDefFoundError:org / objectweb / asm / ClassVisitor
I have the objectweb-asm package installed, with the jar files in /usr/share/java/objectweb-asm
. 我安装了objectweb-asm软件包,其中的jar文件位于
/usr/share/java/objectweb-asm
。 I made symbolic links to the asm jar files from ~/.ant/lib/
, but that doesn't change anything. 我从
~/.ant/lib/
建立了指向asm jar文件的符号链接,但这并没有任何改变。 Nor does making symbolic links to the jar file from inside /usr/share/java
. 也没有从
/usr/share/java
内部建立到jar文件的符号链接。
So, how do I make this work? 那么,我该如何做呢?
I'm using PMD 4.2.5, Ant 1.8.4, and objectweb-asm 3.3.1-7 我正在使用PMD 4.2.5,Ant 1.8.4和objectweb-asm 3.3.1-7
The full error message from Ant: 来自Ant的完整错误消息:
.../build.xml:526: java.lang.NoClassDefFoundError: org/objectweb/asm/ClassVisitor
at net.sourceforge.pmd.typeresolution.ClassTypeResolver.<init>(ClassTypeResolver.java:136)
at net.sourceforge.pmd.typeresolution.TypeResolutionFacade.initializeWith(TypeResolutionFacade.java:15)
at net.sourceforge.pmd.sourcetypehandlers.JavaTypeHandler$3.start(JavaTypeHandler.java:35)
at net.sourceforge.pmd.PMD.processFile(PMD.java:118)
at net.sourceforge.pmd.PMD.processFile(PMD.java:75)
at net.sourceforge.pmd.PMD.processFile(PMD.java:210)
at net.sourceforge.pmd.PMD$PmdRunnable.call(PMD.java:469)
at net.sourceforge.pmd.PMD$PmdRunnable.call(PMD.java:427)
at java.util.concurrent.FutureTask.run(FutureTask.java:262)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:744)
Caused by: java.lang.ClassNotFoundException: org.objectweb.asm.ClassVisitor
at org.apache.tools.ant.AntClassLoader.findClassInComponents(AntClassLoader.java:1365)
at org.apache.tools.ant.AntClassLoader.findClass(AntClassLoader.java:1315)
at org.apache.tools.ant.AntClassLoader.loadClass(AntClassLoader.java:1068)
at java.lang.ClassLoader.loadClass(ClassLoader.java:358)
... 12 more
Turns out the problem is that PMD is expecting the main Objectweb asm jar file to be named asm-3.3.1.jar
, when it's actually asm.jar
. 原来的问题是PMD期望将Objectweb主asm jar文件命名为
asm-3.3.1.jar
,而实际上是asm.jar
。 A simple soft link solved the problem. 一个简单的软链接解决了这个问题。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.