#jenkins #maven-3
#дженкинс #maven-3
Вопрос:
При выполнении следующего тестового примера junit jenkins: https://github.com/ch007m/jenkins-job-dsl/blob/main/src/test/java/dev/snowdrop/MavenJobDSLTest.java , затем задание Дженкинса вызывает эту ошибку, связанную с проблемой Eclipse Either / sisu injection
=== Starting dev.snowdrop.MavenJobDSLTest
[...truncated 1.32 KB...]
Parsing POMs
ERROR: Failed to parse POMs
hudson.maven.MavenEmbedderException: com.google.inject.ProvisionException: Unable to provision, see the following errors:
1) Error injecting: public org.apache.maven.repository.internal.DefaultVersionResolver org.apache.maven.repository.internal.DefaultVersionResolver.setMetadataResolver(org.eclipse.aether.impl.MetadataResolver)
at ClassRealm[maven, parent: ClassRealm[maven-parent, parent: null]] (via modules: org.eclipse.sisu.wire.WireModule -> org.eclipse.sisu.plexus.PlexusBindingModule)
while locating org.apache.maven.repository.internal.DefaultVersionResolver
while locating java.lang.Object annotated with *
at org.eclipse.sisu.wire.LocatorWiring
while locating org.eclipse.aether.impl.VersionResolver
for the 1st parameter of org.eclipse.aether.internal.impl.DefaultRepositorySystem.<init>(DefaultRepositorySystem.java:127)
while locating org.eclipse.aether.internal.impl.DefaultRepositorySystem
while locating java.lang.Object annotated with *
while locating org.apache.maven.artifact.resolver.DefaultArtifactResolver
at ClassRealm[maven, parent: ClassRealm[maven-parent, parent: null]] (via modules: org.eclipse.sisu.wire.WireModule -> org.eclipse.sisu.plexus.PlexusBindingModule)
while locating org.apache.maven.artifact.resolver.ArtifactResolver
while locating org.apache.maven.repository.legacy.LegacyRepositorySystem
at ClassRealm[maven, parent: ClassRealm[maven-parent, parent: null]] (via modules: org.eclipse.sisu.wire.WireModule -> org.eclipse.sisu.plexus.PlexusBindingModule)
while locating org.apache.maven.repository.RepositorySystem
1 error
role: org.apache.maven.repository.RepositorySystem
roleHint:
at hudson.maven.MavenEmbedder.<init>(MavenEmbedder.java:131)
at hudson.maven.MavenEmbedder.<init>(MavenEmbedder.java:110)
at hudson.maven.MavenEmbedder.<init>(MavenEmbedder.java:137)
at hudson.maven.MavenUtil.createEmbedder(MavenUtil.java:211)
at hudson.maven.MavenModuleSetBuild$PomParser.invoke(MavenModuleSetBuild.java:1321)
at hudson.maven.MavenModuleSetBuild$PomParser.invoke(MavenModuleSetBuild.java:1124)
at hudson.FilePath.act(FilePath.java:1076)
at hudson.FilePath.act(FilePath.java:1059)
at hudson.maven.MavenModuleSetBuild$MavenModuleSetBuildExecution.parsePoms(MavenModuleSetBuild.java:985)
at hudson.maven.MavenModuleSetBuild$MavenModuleSetBuildExecution.doRun(MavenModuleSetBuild.java:689)
at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:513)
at hudson.model.Run.execute(Run.java:1907)
at hudson.maven.MavenModuleSetBuild.run(MavenModuleSetBuild.java:543)
at hudson.model.ResourceController.execute(ResourceController.java:97)
at hudson.model.Executor.run(Executor.java:429)
Caused by: org.codehaus.plexus.component.repository.exception.ComponentLookupException: com.google.inject.ProvisionException: Unable to provision, see the following errors:
1) Error injecting: public org.apache.maven.repository.internal.DefaultVersionResolver org.apache.maven.repository.internal.DefaultVersionResolver.setMetadataResolver(org.eclipse.aether.impl.MetadataResolver)
at ClassRealm[maven, parent: ClassRealm[maven-parent, parent: null]] (via modules: org.eclipse.sisu.wire.WireModule -> org.eclipse.sisu.plexus.PlexusBindingModule)
while locating org.apache.maven.repository.internal.DefaultVersionResolver
while locating java.lang.Object annotated with *
at org.eclipse.sisu.wire.LocatorWiring
while locating org.eclipse.aether.impl.VersionResolver
for the 1st parameter of org.eclipse.aether.internal.impl.DefaultRepositorySystem.<init>(DefaultRepositorySystem.java:127)
while locating org.eclipse.aether.internal.impl.DefaultRepositorySystem
while locating java.lang.Object annotated with *
while locating org.apache.maven.artifact.resolver.DefaultArtifactResolver
at ClassRealm[maven, parent: ClassRealm[maven-parent, parent: null]] (via modules: org.eclipse.sisu.wire.WireModule -> org.eclipse.sisu.plexus.PlexusBindingModule)
while locating org.apache.maven.artifact.resolver.ArtifactResolver
while locating org.apache.maven.repository.legacy.LegacyRepositorySystem
at ClassRealm[maven, parent: ClassRealm[maven-parent, parent: null]] (via modules: org.eclipse.sisu.wire.WireModule -> org.eclipse.sisu.plexus.PlexusBindingModule)
while locating org.apache.maven.repository.RepositorySystem
Вот определенные зависимости
testCompile("org.antlr:antlr4-runtime:4.5")
testCompile("org.apache.maven:maven-artifact:3.6.3")
testCompile('org.apache.maven:maven-compat:3.6.3')
testCompile("org.jenkins-ci.lib:lib-jenkins-maven-embedder:3.15")
testCompile("org.jvnet.hudson:hudson-maven-embedder:3.2")
testCompile 'org.jenkins-ci.main:maven-plugin:3.8@jar'
Я пропускаю зависимость или у нас проблема с загрузкой классов, …. ?
Приветствия
Чарльз
Ответ №1:
Я исправил проблему после локальной распаковки содержимого архива jpi для теста junit — см.: https://github.com/ch007m/jenkins-job-dsl/blob/4917f812106351ced36243c2bd804957d0801735/build.gradle#L78
В этом случае у нас больше нет конфликтов классов, о которых сообщает eclipse sisu / guice