Maven - ClassNotFoundException:org.apache.commons.lang.StringUtils

时间:2017-08-09 11:22:40

标签: java maven spring-boot dependencies

有人可以解释这个错误是什么以及何时发生?

Downloading: file://C:/.../org/springframework/boot/spring-boot-dependencies/1.4.0.RELEASE/spring-boot-dependencies-1.4.0.RELEASE.pom
Exception in thread "pool-11-thread-1" ---------------------------------------------------
constituent[0]: file:/C:/Program%20Files/NetBeans%208.2/java/maven/lib/aether-api-1.13.1.jar
constituent[1]: file:/C:/Program%20Files/NetBeans%208.2/java/maven
constituent[18]: file:/C:/Program%20Files/NetBeans%208.2/java/maven/lib/plexus-component-annotations-1.5.5.jar
constituent[19]: file:/C:/Program%20Files/NetBeans%208.2/java/maven/lib/plexus-interpolation-1.14.jarjava.lang.NoClassDefFoundError: org/apache/commons/lang/StringUtils
    at org.apache.maven.wagon.providers.file.FileWagon.resolveDestinationPath(FileWagon.java:206)
    at org.apache.maven.wagon.providers.file.FileWagon.resourceExists(FileWagon.java:265)
    at org.sonatype.aether.connector.wagon.WagonRepositoryConnector$GetTask.run(WagonRepositoryConnector.java:577)
    at org.sonatype.aether.util.concurrency.RunnableErrorForwarder$1.run(RunnableErrorForwarder.java:60)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
    at java.lang.Thread.run(Thread.java:748)
Caused by: java.lang.ClassNotFoundException: org.apache.commons.lang.StringUtils
    at org.codehaus.plexus.classworlds.strategy.SelfFirstStrategy.loadClass(SelfFirstStrategy.java:50)
    at org.codehaus.plexus.classworlds.realm.ClassRealm.loadClass(ClassRealm.java:244)
    at org.codehaus.plexus.classworlds.realm.ClassRealm.loadClass(ClassRealm.java:230)
    ... 7 more

为什么maven找不到org.apache.commons.lang.StringUtils。查看本地存储库,我能够找到org\apache\maven\wagon\wagon-providers\2.7\...org\apache\commons\parent\...org\apache\commons\lang\...org\apache\commons\exec\...org\apache\commons\compress\...org\apache\commons\pool2\...。我无法弄清楚这个问题何时发生,所以我无法解决这个问题...

2 个答案:

答案 0 :(得分:2)

固定!我已在https://maven.apache.org/download.cgi下手动下载maven 3.5,并将文件commons-lang3-3.5.jar复制到C:\Program Files\NetBeans 8.2\java\maven\lib\。我正在使用NetBeans 8.2和Maven作为插件。

答案 1 :(得分:0)

尝试在pom.xml中添加此依赖项:

<dependency>
    <groupId>commons-lang</groupId>
    <artifactId>commons-lang</artifactId>
    <version>2.6</version>
</dependency>