Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-64473

Error injecting: public org.apache.maven.repository.internal.DefaultVersionResolver

    XMLWordPrintable

    Details

    • Similar Issues:

      Description

      When the following junit jenkins test case is executed : https://github.com/ch007m/jenkins-job-dsl/blob/main/src/test/java/dev/snowdrop/MavenJobDSLTest.java, then the jenkins job raises this error related to an Eclipse Either/sisu injection problem

       

      === 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
      

      Here are the dependencies defined within the github project shared

      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'

      I also tried to use the same dependencies as generated by the mavenJob executed in a standalone jenkins instance without success

      java -cp /Users/cmoullia/temp/jenkins/local/plugins/maven-plugin/WEB-INF/lib/maven35-agent-1.13.jar:/Users/cmoullia/temp/jenkins/local/tools/hudson.tasks.Maven_MavenInstallation/maven3/boot/plexus-classworlds-2.6.0.jar:/Users/cmoullia/temp/jenkins/local/tools/hudson.tasks.Maven_MavenInstallation/maven3/conf/logging jenkins.maven3.agent.Maven35Main /Users/cmoullia/temp/jenkins/local/tools/hudson.tasks.Maven_MavenInstallation/maven3 /Users/cmoullia/temp/jenkins/local/war/WEB-INF/lib/remoting-4.6.jar /Users/cmoullia/temp/jenkins/local/plugins/maven-plugin/WEB-INF/lib/maven35-interceptor-1.13.jar /Users/cmoullia/temp/jenkins/local/plugins/maven-plugin/WEB-INF/lib/maven3-interceptor-commons-1.13.jar
      

      Do I miss a dependency or do we have a classloading issue, .... ?

      Cheers

      Charles

        Attachments

          Activity

          Hide
          cmoulliard Charles Moulliard added a comment -

           
          I fixed the problem after unzipping the content of the jpi archive locally for the junit test - see: https://github.com/ch007m/jenkins-job-dsl/blob/4917f812106351ced36243c2bd804957d0801735/build.gradle#L78

          This is not elegant as it will needed top hack the gradle or maven pom file to fetch the jpi, unzip it and copy the jar under a test temp folder and that the test load such jar files during its execution

          In this case, we dont have anymore class conflicts reported by eclipse sisu/guice

          Show
          cmoulliard Charles Moulliard added a comment -   I fixed the problem after unzipping the content of the jpi archive locally for the junit test - see:  https://github.com/ch007m/jenkins-job-dsl/blob/4917f812106351ced36243c2bd804957d0801735/build.gradle#L78 This is not elegant as it will needed top hack the gradle or maven pom file to fetch the jpi, unzip it and copy the jar under a test temp folder and that the test load such jar files during its execution In this case, we dont have anymore class conflicts reported by eclipse sisu/guice

            People

            Assignee:
            olamy Olivier Lamy
            Reporter:
            cmoulliard Charles Moulliard
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Dates

              Created:
              Updated: