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

Add explicit transitive dependencies in dependencyManagement section of pom.xml

    XMLWordPrintableJSON

Details

    • New Feature
    • Status: Closed
    • Major
    • Resolution: Duplicate
    • 2.0.9
    • None
    • Dependencies
    • None

    Description

      Transitive dependencies cause lots of headaches and require a fair amount of manual intervention to fix conflicts. It is common to see a pom with the following scenario:

      <dependencyManagement>
      <dependencies>
      <!-- Must manually include com.other.common when using com.sample.foo -->
      <dependency>
      <groupId>com.sample</groupId>
      <artifactId>foo</artifactId>
      <version>1</version>
      <exclusions>
      <!-- com.sample.foo includes old version 1 of com.other.common -->
      <exclusion>
      <groupId>com.other</groupId>
      <artifactId>common</artifactId>
      </exclusion>
      </exclusions>
      </dependency>
      <dependency>
      <groupId>com.other</groupId>
      <artifactId>common</artifactId>
      <version>2</version>
      </dependency>
      <dependency>
      <groupId>com.sample</groupId>
      <artifactId>bar</artifactId>
      <version>3</version>
      <!-- com.sample.foo includes version 2 of com.other.common -->
      </dependency>
      </dependencies>
      </dependencyManagement>

      This is problematic because descendant poms must manually include the com.other.common dependency when including the com.sample.foo dependency. The word around is creating separate pom projects to manage the dependencies, but this doesn't do a great job of expressing intent, leads to a proliferation of projects, and makes dependency management more difficult since it's scattered over multiple poms.

      Ideally users should be allowed to specify inclusions in the dependency management section of the pom e.g. something like:

      <dependencyManagement>
      <dependencies>
      <dependency>
      <groupId>com.sample</groupId>
      <artifactId>foo</artifactId>
      <version>1</version>
      <!-- com.sample.foo includes old version 1 of com.other.common -->
      <exclusions>
      <exclusion>
      <groupId>com.other</groupId>
      <artifactId>common</artifactId>
      </exclusion>
      </exclusions>
      <inclusions>
      <inclusion>
      <groupId>com.other</groupId>
      <artifactId>common</artifactId>
      <version>2</version>
      </inclusion>
      </inclusions>
      </dependency>
      <dependency>
      <groupId>com.sample</groupId>
      <artifactId>bar</artifactId>
      <version>3</version>
      <!-- com.sample.foo includes version 2 of com.other.common -->
      </dependency>
      </dependencies>
      </dependencyManagement>

      Attachments

        Issue Links

          Activity

            People

              brett Brett Porter
              joel.turkel Joel Turkel
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: