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

No upstream or downstream resolution with Maven version ranges

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Major Major
    • maven-plugin
    • None

      This is essentially reopening JENKINS-2787 (https://issues.jenkins-ci.org/browse/JENKINS-2787). We are in an environment where we do have version ranges and ignoring the arguments for or against version ranges, we like to resolve this issue. I have looked at the patch provided in JENKINS-2787 and have integrated this into the latest 1.450 of jenkins and running this in our CI environment.

      What would be required to submit this latest patch to Jenkins and have this promoted?

          [JENKINS-12735] No upstream or downstream resolution with Maven version ranges

          Jay Meyer added a comment - - edited

          The new bug is not related to Maven version ranges. Instead, its about specific versions. My project has specific version numbers: e.g 1.1 vs. 1.2 in the pom dependencies specified. But when Jenkins reads them, it builds every OLD version of the downstream dependencies. A scenario is spelled out in JENKINS-15367. And also bad, the old downstream versions are NOT built by the old upstream version, because Jenkins has associated the downstream projects with the incorrect upstream projects. So in this state I can no longer build version 1.1 of the system of projects. And the 1.2 version kicks off too many build, because it builds all of the 1.1 builds too.

          Jay Meyer added a comment - - edited The new bug is not related to Maven version ranges. Instead, its about specific versions. My project has specific version numbers: e.g 1.1 vs. 1.2 in the pom dependencies specified. But when Jenkins reads them, it builds every OLD version of the downstream dependencies. A scenario is spelled out in JENKINS-15367 . And also bad, the old downstream versions are NOT built by the old upstream version, because Jenkins has associated the downstream projects with the incorrect upstream projects. So in this state I can no longer build version 1.1 of the system of projects. And the 1.2 version kicks off too many build, because it builds all of the 1.1 builds too.

          I did attach two simple test-scenarios, both with project "A" and "B".

          In the "working" scenario, jenkins did see the relationship correctly between B and A, so that when B was build A will be build later. (makes sense, direct dependency did change)

          In the "failing" scenario, the "B" project did create a release (0.0.1), move the development version to 0.0.2-SNAPSHOT. However the A project decides that they want only the latest stable version, so they switch their dependency to the 0.0.1 release.

          Now, however, when Jenkins (1.487) builds B with 0.0.2-SNAPSHOT it does trigger the A job too! (which makes no sense, because A is using the "stable" build 0.0.1, which should not change, so no re-building ins needed.)
          This did lead to a massive increase of number of projects building (and me having to switch off the option on 100+ jenkins jobs ..)

          I think the behavior was correct at least in 1.474, where only depdencencies with exactly the same dependency version got build.

          Michael Glauche added a comment - I did attach two simple test-scenarios, both with project "A" and "B". In the "working" scenario, jenkins did see the relationship correctly between B and A, so that when B was build A will be build later. (makes sense, direct dependency did change) In the "failing" scenario, the "B" project did create a release (0.0.1), move the development version to 0.0.2-SNAPSHOT. However the A project decides that they want only the latest stable version, so they switch their dependency to the 0.0.1 release. Now, however, when Jenkins (1.487) builds B with 0.0.2-SNAPSHOT it does trigger the A job too! (which makes no sense, because A is using the "stable" build 0.0.1, which should not change, so no re-building ins needed.) This did lead to a massive increase of number of projects building (and me having to switch off the option on 100+ jenkins jobs ..) I think the behavior was correct at least in 1.474, where only depdencencies with exactly the same dependency version got build.

          The behavior was correct up to 1.480, I'm blocked also to this version.

          Arnaud Héritier added a comment - The behavior was correct up to 1.480, I'm blocked also to this version.

          Alex Koon added a comment -

          I am trying to look into this.

          Alex Koon added a comment - I am trying to look into this.

          Alex Koon added a comment -

          I think I have found the bug. I have a unit test to prove the bug and the associated fix. Its related to the way the maven API deals with versions http://maven.apache.org/ref/3.0.3/maven-artifact/apidocs/org/apache/maven/artifact/versioning/VersionRange.html#createFromVersion(java.lang.String)

          Although this is fixed via unit tests, I would like a few days testing on a Jenkins instance to prove it works.

          I will try and submit a patch soon subject to work load.

          Alex Koon added a comment - I think I have found the bug. I have a unit test to prove the bug and the associated fix. Its related to the way the maven API deals with versions http://maven.apache.org/ref/3.0.3/maven-artifact/apidocs/org/apache/maven/artifact/versioning/VersionRange.html#createFromVersion(java.lang.String ) Although this is fixed via unit tests, I would like a few days testing on a Jenkins instance to prove it works. I will try and submit a patch soon subject to work load.

          This could be the reason, I remember there was some breaking change from 3.0.3 to 3.0.4 with SNAPSHOTS in version ranges, but i can't find it anymore.

          But, there's still MNG-3092 , which could be the main reason behind it. This thread on the maven list also goes in detail about the problem.

          Michael Glauche added a comment - This could be the reason, I remember there was some breaking change from 3.0.3 to 3.0.4 with SNAPSHOTS in version ranges, but i can't find it anymore. But, there's still MNG-3092 , which could be the main reason behind it. This thread on the maven list also goes in detail about the problem.

          Alex Koon added a comment -

          Alex Koon added a comment - Commented on this at https://issues.jenkins-ci.org/browse/JENKINS-15367 .

          Alex Koon added a comment -

          Marking as resolved. JENKINS-15367 deals with the bug (now pulled to master) where defined versions are not correctly processes.

          Alex Koon added a comment - Marking as resolved. JENKINS-15367 deals with the bug (now pulled to master) where defined versions are not correctly processes.

          Code changed in jenkins
          User: alexkoon
          Path:
          src/main/java/hudson/maven/MavenModule.java
          src/main/java/hudson/maven/ModuleDependency.java
          src/test/java/hudson/maven/MavenModuleTest.java
          http://jenkins-ci.org/commit/maven-plugin/3d81dd6f9518ce3b1534083da61a05c42c510516
          Log:
          JENKINS-12735 - Maven version range resolution.

          Originally-Committed-As: 65cd6555301535af4f8796a694c4d52664205778

          SCM/JIRA link daemon added a comment - Code changed in jenkins User: alexkoon Path: src/main/java/hudson/maven/MavenModule.java src/main/java/hudson/maven/ModuleDependency.java src/test/java/hudson/maven/MavenModuleTest.java http://jenkins-ci.org/commit/maven-plugin/3d81dd6f9518ce3b1534083da61a05c42c510516 Log: JENKINS-12735 - Maven version range resolution. Originally-Committed-As: 65cd6555301535af4f8796a694c4d52664205778

          Code changed in jenkins
          User: Kohsuke Kawaguchi
          Path:
          src/main/java/hudson/maven/MavenModule.java
          src/main/java/hudson/maven/ModuleDependency.java
          src/main/java/hudson/maven/ModuleName.java
          src/test/java/hudson/maven/MavenModuleTest.java
          http://jenkins-ci.org/commit/maven-plugin/151a41df0bce7f22d8d129d8bc8dd759e0d9ed95
          Log:
          [FIXED JENKINS-12735] Merge branch 'pull-542'

          Originally-Committed-As: a0c02400313cee84e06a960be29b8f43389ab274

          SCM/JIRA link daemon added a comment - Code changed in jenkins User: Kohsuke Kawaguchi Path: src/main/java/hudson/maven/MavenModule.java src/main/java/hudson/maven/ModuleDependency.java src/main/java/hudson/maven/ModuleName.java src/test/java/hudson/maven/MavenModuleTest.java http://jenkins-ci.org/commit/maven-plugin/151a41df0bce7f22d8d129d8bc8dd759e0d9ed95 Log: [FIXED JENKINS-12735] Merge branch 'pull-542' Originally-Committed-As: a0c02400313cee84e06a960be29b8f43389ab274

            Unassigned Unassigned
            alexkoon Alex Koon
            Votes:
            1 Vote for this issue
            Watchers:
            12 Start watching this issue

              Created:
              Updated:
              Resolved: