Maven
  1. Maven
  2. MNG-4821

Wrong spring-context version resolved when depending on artifact with dependency management and jersey-spring dependency

    Details

    • Type: Bug Bug
    • Status: Closed Closed
    • Priority: Major Major
    • Resolution: Duplicate
    • Affects Version/s: 2.2.1
    • Fix Version/s: None
    • Component/s: Dependencies
    • Labels:
      None
    • Environment:
      Ubuntu 10.04 64-bit, jdk6
      Windows 7 64-bit, Cygwin, jdk6
      Windows XP SP3 32-bit, Cygwin, jdk5
    • Complexity:
      Intermediate
    • Number of attachments :
      1

      Description

      Given two artifacts, A and B:

      • A depends on B and on org.springframework:spring-context:3.0.1.RELEASE
      • B depends on com.sun.jersey.contribs:jersey-spring:1.2 and has a dependency management entry that sets the version for org.springframework:spring-context to 3.0.2.RELEASE
      • com.sun.jersey.contribs:jersey-spring:1.2 depends on org.springframework:spring-context:[2.5.2,3)

      When B is built, maven uses org.springframework:spring-context:jar:3.0.2.RELEASE, as expected.
      When A is built, maven 2 uses org.springframework:spring-context:jar:2.5.6, and maven 3 uses version 2.5.6.SEC02.

      I'm attaching a sample project that demonstrates the bug. There are two poms: dependent and dependee. These correspond to A and B above, respectively. The top-level pom just includes the other two for ease of building. In the real-life situation where I found the problem, the two artifacts are from separate projects. There is no unit test, since I don't even know how I'd write a test for this, but there is a bash script called test.sh that checks for the problem.

        Issue Links

          Activity

          Hide
          Benjamin Bentmann added a comment -

          Thanks for the example projects. When building A, B's dependencyManagement is ignored (MNG-3038) such that the dependeny graph for A contains the original spring-context:[2.5.2,3) dependency as given by jersey-spring:1.2. Futhermore, a version range overrules any soft version recommendations like the 3.0.1.RELEASE given in A's POM. That's why A ends up with spring-context:jar:2.5.x.

          For now, you need to use dependency management in A to enforce the version of spring-context you want.

          When A is built, maven 2 uses org.springframework:spring-context:jar:2.5.6, and maven 3 uses version 2.5.6.SEC02.

          This minor difference is the effect of improved version comparision in Maven 3 which properly recognizes 2.5.6 < 2.5.6.SEC01 < 2.5.6.SEC02.

          Show
          Benjamin Bentmann added a comment - Thanks for the example projects. When building A, B's dependencyManagement is ignored ( MNG-3038 ) such that the dependeny graph for A contains the original spring-context:[2.5.2,3) dependency as given by jersey-spring:1.2 . Futhermore, a version range overrules any soft version recommendations like the 3.0.1.RELEASE given in A's POM. That's why A ends up with spring-context:jar:2.5.x . For now, you need to use dependency management in A to enforce the version of spring-context you want. When A is built, maven 2 uses org.springframework:spring-context:jar:2.5.6, and maven 3 uses version 2.5.6.SEC02. This minor difference is the effect of improved version comparision in Maven 3 which properly recognizes 2.5.6 < 2.5.6.SEC01 < 2.5.6.SEC02 .

            People

            • Assignee:
              Benjamin Bentmann
              Reporter:
              Ryan Stewart
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: