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

maven-plugin not usable as a dependency with parent-pom 2.31+

    • Icon: Improvement Improvement
    • Resolution: Fixed
    • Icon: Minor Minor
    • maven-plugin
    • None

      when you have a plugin using jenkins-plugins 2.31+ as it's parent and a dependency on the maven plugin then the build will fail.

      This is because the RequireUpperBounds enforcer will fail as all the different versions of the interceptors and agents use conflicting versions of the core maven libraries.

      [WARNING] Rule 5: org.apache.maven.plugins.enforcer.RequireUpperBoundDeps failed with message:
      Failed while enforcing RequireUpperBoundDeps. The error(s) are [
      Require upper bound dependencies error for org.apache.maven:maven-embedder:3.1.0 paths to dependency are:
      +-com.acme.wibble:my-project:1.0.0-SNAPSHOT
        +-org.jenkins-ci.main:maven-plugin:2.11
          +-org.apache.maven:maven-embedder:3.1.0
      and
      +-com.acme.wibble:my-project:1.0.0-SNAPSHOT
        +-org.jenkins-ci.main:maven-plugin:2.11
          +-org.jenkins-ci.main.maven:maven3-agent:1.6
            +-org.apache.maven:maven-embedder:3.0.5
      and
      +-com.acme.wibble:my-project:1.0.0-SNAPSHOT
        +-org.jenkins-ci.main:maven-plugin:2.11
          +-org.jenkins-ci.main.maven:maven31-agent:1.6
            +-org.apache.maven:maven-embedder:3.1.0
      and
      +-com.acme.wibble:my-project:1.0.0-SNAPSHOT
        +-org.jenkins-ci.main:maven-plugin:2.11
          +-org.jenkins-ci.main.maven:maven32-agent:1.6
            +-org.apache.maven:maven-embedder:3.2.3
      and
      +-com.acme.wibble:my-project:1.0.0-SNAPSHOT
        +-org.jenkins-ci.main:maven-plugin:2.11
          +-org.jenkins-ci.main.maven:maven3-interceptor:1.6
            +-org.apache.maven:maven-embedder:3.0.5
      and
      +-com.acme.wibble:my-project:1.0.0-SNAPSHOT
        +-org.jenkins-ci.main:maven-plugin:2.11
          +-org.jenkins-ci.main.maven:maven31-interceptor:1.6
            +-org.apache.maven:maven-embedder:3.1.0
      and
      +-com.acme.wibble:my-project:1.0.0-SNAPSHOT
        +-org.jenkins-ci.main:maven-plugin:2.11
          +-org.jenkins-ci.main.maven:maven32-interceptor:1.6
            +-org.apache.maven:maven-embedder:3.2.3
      and
      +-com.acme.wibble:my-project:1.0.0-SNAPSHOT
        +-org.jenkins-ci.main:maven-plugin:2.11
          +-org.jenkins-ci.main.maven:maven3-interceptor-commons:1.6
            +-org.apache.maven:maven-embedder:3.0.5
      and
      +-com.acme.wibble:my-project:1.0.0-SNAPSHOT
        +-org.jenkins-ci.main:maven-plugin:2.11
          +-org.jenkins-ci.lib:lib-jenkins-maven-embedder:3.11
            +-org.apache.maven:maven-embedder:3.1.0
      ,
      Require upper bound dependencies error for org.apache.maven:maven-core:3.1.0 paths to dependency are:
      +-com.acme.wibble:my-project:1.0.0-SNAPSHOT
        +-org.jenkins-ci.main:maven-plugin:2.11
          +-org.apache.maven:maven-core:3.1.0
      and
      +-com.acme.wibble:my-project:1.0.0-SNAPSHOT
        +-org.jenkins-ci.main:maven-plugin:2.11
          +-org.jenkins-ci.main.maven:maven3-interceptor:1.6
            +-org.apache.maven:maven-core:3.0.5
      and
      +-com.acme.wibble:my-project:1.0.0-SNAPSHOT
        +-org.jenkins-ci.main:maven-plugin:2.11
          +-org.jenkins-ci.main.maven:maven31-interceptor:1.6
            +-org.apache.maven:maven-core:3.1.0
      and
      +-com.acme.wibble:my-project:1.0.0-SNAPSHOT
        +-org.jenkins-ci.main:maven-plugin:2.11
          +-org.jenkins-ci.main.maven:maven32-interceptor:1.6
            +-org.apache.maven:maven-core:3.2.3
      and
      +-com.acme.wibble:my-project:1.0.0-SNAPSHOT
        +-org.jenkins-ci.main:maven-plugin:2.11
          +-org.jenkins-ci.main.maven:maven3-interceptor-commons:1.6
            +-org.apache.maven:maven-core:3.0.5
      and
      +-com.acme.wibble:my-project:1.0.0-SNAPSHOT
        +-org.jenkins-ci.main:maven-plugin:2.11
          +-org.apache.maven:maven-compat:3.1.0
            +-org.apache.maven:maven-core:3.1.0
      and
      +-com.acme.wibble:my-project:1.0.0-SNAPSHOT
        +-org.jenkins-ci.main:maven-plugin:2.11
          +-org.apache.maven:maven-embedder:3.1.0
            +-org.apache.maven:maven-core:3.1.0
      and
      +-com.acme.wibble:my-project:1.0.0-SNAPSHOT
        +-org.jenkins-ci.main:maven-plugin:2.11
          +-org.jenkins-ci.lib:lib-jenkins-maven-embedder:3.11
            +-org.apache.maven:maven-core:3.1.0
      ,
      Require upper bound dependencies error for org.apache.maven:maven-aether-provider:3.1.0 paths to dependency are:
      +-com.acme.wibble:my-project:1.0.0-SNAPSHOT
        +-org.jenkins-ci.main:maven-plugin:2.11
          +-org.apache.maven:maven-aether-provider:3.1.0
      and
      +-com.acme.wibble:my-project:1.0.0-SNAPSHOT
        +-org.jenkins-ci.main:maven-plugin:2.11
          +-org.jenkins-ci.main.maven:maven3-interceptor:1.6
            +-org.apache.maven:maven-aether-provider:3.0.5
      and
      +-com.acme.wibble:my-project:1.0.0-SNAPSHOT
        +-org.jenkins-ci.main:maven-plugin:2.11
          +-org.jenkins-ci.main.maven:maven31-interceptor:1.6
            +-org.apache.maven:maven-aether-provider:3.1.0
      and
      +-com.acme.wibble:my-project:1.0.0-SNAPSHOT
        +-org.jenkins-ci.main:maven-plugin:2.11
          +-org.jenkins-ci.main.maven:maven32-interceptor:1.6
            +-org.apache.maven:maven-aether-provider:3.2.3
      and
      +-com.acme.wibble:my-project:1.0.0-SNAPSHOT
        +-org.jenkins-ci.main:maven-plugin:2.11
          +-org.jenkins-ci.main.maven:maven3-interceptor-commons:1.6
            +-org.apache.maven:maven-aether-provider:3.0.5
      and
      +-com.acme.wibble:my-project:1.0.0-SNAPSHOT
        +-org.jenkins-ci.main:maven-plugin:2.11
          +-org.apache.maven:maven-core:3.1.0
            +-org.apache.maven:maven-aether-provider:3.1.0
      and
      +-com.acme.wibble:my-project:1.0.0-SNAPSHOT
        +-org.jenkins-ci.main:maven-plugin:2.11
          +-org.jenkins-ci.lib:lib-jenkins-maven-embedder:3.11
            +-org.apache.maven:maven-aether-provider:3.1.0
      ]
      [INFO] ------------------------------------------------------------------------
      [INFO] BUILD FAILURE
      [INFO] ------------------------------------------------------------------------
      [INFO] Total time: 10.994 s
      [INFO] Finished at: 2017-07-03T17:48:51+01:00
      [INFO] Final Memory: 35M/369M
      [INFO] ------------------------------------------------------------------------
      [ERROR] Failed to execute goal org.apache.maven.plugins:maven-enforcer-plugin:1.4.2.jenkins-1:enforce (display-info) on project my-project: Some Enforcer rules have failed. Look above for specific messages explaining why the rule failed. -> [Help 1]
      

      these conflicts are wholly within the maven-plugin project and do not include any 3rd party plugins or other dependencies.

      If you attempt to exclude these transitive dependencies then the build will fail when the maven project type is used within a JenkinsRule

      Parsing POMs
      FATAL: org/apache/maven/project/ProjectBuildingException
      java.lang.ClassNotFoundException: org.apache.maven.project.ProjectBuildingException
      

      jglick suggests that the potential fix may be to make the maven libraries have scope=provided

          [JENKINS-45271] maven-plugin not usable as a dependency with parent-pom 2.31+

          James Nord created issue -
          James Nord made changes -
          Summary Original: maven-project not usable as a dependency with parent-pom 2.31+ New: maven-plugin not usable as a dependency with parent-pom 2.31+

          Jesse Glick added a comment -

          The workaround would simply be to exclude enforcement of upper bounds on those artifacts, but yes I suspect the proper fix is to use provided scope. Should be possible to prototype in maven-plugin itself simply by updating its parent POM.

          Jesse Glick added a comment - The workaround would simply be to exclude enforcement of upper bounds on those artifacts, but yes I suspect the proper fix is to use provided scope. Should be possible to prototype in maven-plugin itself simply by updating its parent POM.
          Jesse Glick made changes -
          Link New: This issue is blocking JENKINS-41631 [ JENKINS-41631 ]
          Oleg Nenashev made changes -
          Assignee New: Oleg Nenashev [ oleg_nenashev ]
          Oleg Nenashev made changes -
          Status Original: Open [ 1 ] New: In Progress [ 3 ]
          Oleg Nenashev made changes -
          Remote Link New: This issue links to "https://github.com/jenkinsci/maven-interceptors/pull/12 (Web Link)" [ 17454 ]
          Oleg Nenashev made changes -
          Remote Link New: This issue links to "https://github.com/jenkinsci/pom/pull/14 (Web Link)" [ 17455 ]
          Oleg Nenashev made changes -
          Remote Link New: This issue links to "https://github.com/jenkinsci/maven-plugin/pull/102 (Web Link)" [ 17456 ]
          Oleg Nenashev made changes -
          Status Original: In Progress [ 3 ] New: In Review [ 10005 ]

            oleg_nenashev Oleg Nenashev
            teilo James Nord
            Votes:
            1 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: