我正在开发一个 Maven 插件项目,该项目调用一个 jar 文件,该文件从 maven-aether-provider.jar 中的 MavenRepositorySystemUtils 调用一个函数。但是,我一直收到如下异常,
Caused by: java.lang.NoClassDefFoundError: org/apache/maven/repository/internal/MavenRepositorySystemUtils
at com.dbx.upload.Utils.NexusUtils.ManualRepositorySystemFactory.newRepositorySystem(ManualRepositorySystemFactory.java:27)
at com.dbx.upload.Utils.NexusUtils.Booter.newRepositorySystem(Booter.java:39)
at com.dbx.upload.Downloader.NexusDownloader.download(NexusDownloader.java:69)
at com.dbx.upload.UploadTool.<init>(UploadTool.java:60)
at com.dbx.upload.plugin.UploadMojo.execute(UploadMojo.java:221)
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:101)
... 20 more
Caused by: java.lang.ClassNotFoundException: org.apache.maven.repository.internal.MavenRepositorySystemUtils
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)
... 26 more
[ERROR]
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/PluginContainerException
我已经删除了我的本地仓库并重新运行了 maven 插件但没有成功。我验证了 maven-aether-provider.jar:3.1.0 在本地 repo 下。
一件奇怪的事情是 pluin 领域似乎排除了一些有用的类,如此处所示,
> [DEBUG] Created new class realm plugin>com.dbx.upload.plugin:veracode-maven-plugin:1.0.2-SNAPSHOT
[DEBUG] Importing foreign packages into class realm plugin>com.dbx.upload.plugin:veracode-maven-plugin:1.0.2-SNAPSHOT
[DEBUG] Imported: < maven.api
[DEBUG] Populating class realm plugin>com.dbx.upload.plugin:veracode-maven-plugin:1.0.2-SNAPSHOT
[DEBUG] Included: com.dbx.upload.plugin:veracode-maven-plugin:jar:1.0.2-SNAPSHOT
[DEBUG] Included: org.codehaus.plexus:plexus-utils:jar:3.0.10
[DEBUG] Included: org.eclipse.sisu:org.eclipse.sisu.plexus:jar:0.0.0.M2a
[DEBUG] Included: javax.enterprise:cdi-api:jar:1.0
[DEBUG] Included: javax.annotation:jsr250-api:jar:1.0
[DEBUG] Included: javax.inject:javax.inject:jar:1
[DEBUG] Included: org.sonatype.sisu:sisu-guice:jar:no_aop:3.1.0
[DEBUG] Included: aopalliance:aopalliance:jar:1.0
[DEBUG] Included: org.eclipse.sisu:org.eclipse.sisu.inject:jar:0.0.0.M2a
[DEBUG] Included: asm:asm:jar:3.3.1
[DEBUG] Included: org.codehaus.plexus:plexus-component-annotations:jar:1.5.5
[DEBUG] Included: org.codehaus.plexus:plexus-interpolation:jar:1.16
[DEBUG] Included: org.eclipse.aether:aether-api:jar:0.9.0.M4
[DEBUG] Included: org.eclipse.aether:aether-spi:jar:0.9.0.M4
[DEBUG] Included: org.eclipse.aether:aether-util:jar:0.9.0.M4
[DEBUG] Included: org.eclipse.aether:aether-impl:jar:0.9.0.M4
[DEBUG] Included: org.eclipse.aether:aether-connector-basic:jar:0.9.0.M4
[DEBUG] Included: org.eclipse.aether:aether-transport-file:jar:0.9.0.M4
[DEBUG] Included: org.eclipse.aether:aether-transport-http:jar:0.9.0.M4
[DEBUG] Included: org.slf4j:jcl-over-slf4j:jar:1.6.2
[DEBUG] Included: org.slf4j:slf4j-api:jar:1.6.2
[DEBUG] Excluded: org.apache.maven:maven-plugin-api:jar:3.1.0
[DEBUG] Excluded: org.apache.maven:maven-model:jar:3.1.0
[DEBUG] Excluded: org.apache.maven:maven-artifact:jar:3.1.0
[DEBUG] Excluded: org.codehaus.plexus:plexus-classworlds:jar:2.4
[DEBUG] Excluded: org.apache.maven:maven-aether-provider:jar:3.1.0
[DEBUG] Excluded: org.apache.maven:maven-model-builder:jar:3.1.0
[DEBUG] Excluded: org.apache.maven:maven-repository-metadata:jar:3.1.0
有什么例外的线索吗?非常感谢您的帮助。