Uploaded image for project: 'Maven'
  1. Maven
  2. MNG-6079

3.4 regression: cannot override version of a dependencyManagement in a submodule any more

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Not A Problem
    • needing-scrub-3.4.0-fallout
    • None
    • Dependencies
    • None

    Description

      When you import a <dependencyManagement> section from another pom, you can use a property for the version:

         <dependencyManagement>
            <dependencies>
               <dependency>
                  <groupId>org.apache.maven.surefire</groupId>
                  <artifactId>surefire</artifactId>
                  <version>${surefire.version}</version>
                  <type>pom</type>
                  <scope>import</scope>
               </dependency>
            </dependencies>
         </dependencyManagement>
      

      In Maven 3.3 and before, that version could be overridden in submodules, by overriding the property.
      In Maven 3.4, this doesn't work any more: redefining the property doesn't change the dependencies which are defined.

      I attach a simple example that uses surefire dependencies.
      mvn dependency:list will yield different results:

      • surefire-api:jar:2.12 with Maven 3.3, because this is the overridden version in the pom
      • surefire-api:jar:2.10 with Maven 3.4 (as of snapshot 2016-08-06), which is the version defined in the parent pom

      It is admittedly a corner case, or potentially a bug fix. In Maven 3.4, the behaviour of <dependencyManagement> is now more consistent with the one of <dependencies>, where you can't redefine a dependency version simply by overriding a property.
      It is however a change in behaviour – which broke my build.

      Attachments

        1. pom.xml
          0.8 kB
          Samuel Langlois
        2. parent-pom.xml
          0.9 kB
          Samuel Langlois

        Issue Links

          Activity

            People

              Unassigned Unassigned
              slanglois Samuel Langlois
              Votes:
              0 Vote for this issue
              Watchers:
              6 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: