我正在使用Maven版本3.3.9来构建我的项目。我知道我有一个依赖性问题(正在引入旧版本的库)所以我想使用依赖树来查看正在发生的事情。我的问题是,当我运行mvn dependency:tree
时,我收到以下错误:
[INFO] --- maven-dependency-plugin:2.5.1:tree (default-cli) @ data-access ---
[WARNING] Error injecting:org.apache.maven.shared.dependency.graph.internal.Maven3DependencyGraphBuilder
java.lang.NoClassDefFoundError: org/sonatype/aether/version/VersionConstraint
at java.lang.Class.getDeclaredMethods0(Native Method)
at java.lang.Class.privateGetDeclaredMethods(Class.java:2570)
at java.lang.Class.getDeclaredMethods(Class.java:1855)
at com.google.inject.spi.InjectionPoint.getInjectionPoints(InjectionPoint.java:688)
at com.google.inject.spi.InjectionPoint.forInstanceMethodsAndFields(InjectionPoint.java:380)
at com.google.inject.internal.ConstructorBindingImpl.getInternalDependencies(ConstructorBindingImpl.java:164)
<some lines removed for clarity>
Caused by: java.lang.ClassNotFoundException: org.sonatype.aether.version.VersionConstraint
at org.codehaus.plexus.classworlds.strategy.SelfFirstStrategy.loadClass(SelfFirstStrategy.java:50)
at org.codehaus.plexus.classworlds.realm.ClassRealm.unsynchronizedLoadClass(ClassRealm.java:271)
at org.codehaus.plexus.classworlds.realm.ClassRealm.loadClass(ClassRealm.java:247)
at org.codehaus.plexus.classworlds.realm.ClassRealm.loadClass(ClassRealm.java:239)
... 63 more
<more lines removed for clarity>
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-dependency-plugin:2.5.1:tree (default-cli) on project myProjectName: Execution default-cli of goal org.apache.maven.plugins:maven-dependency-plugin:2.5.1:tree failed: A required class was missing while executing org.apache.maven.plugins:maven-dependency-plugin:2.5.1:tree: org/sonatype/aether/version/VersionConstraint
为什么maven不会拉入它需要的代码?我们该如何解决?