Maven
  1. Maven
  2. MNG-3196

Allow exclusion of a certain transitive dependency across all direct dependencies.

    Details

    • Type: New Feature New Feature
    • Status: Closed Closed
    • Priority: Major Major
    • Resolution: Incomplete
    • Affects Version/s: 2.0.7
    • Fix Version/s: None
    • Component/s: Dependencies
    • Labels:
      None
    • Number of attachments :
      0

      Description

      I would like to be able to put exludes at the top level of dependencies so that it can easily be excluded from all transitive dependencies, instead of just excluding it from a single dependency at a time. For example assume that project1 and project2 both have transitive dependencies on different versions of project-trans:

      <dependencies>
        <exclusions>
          <exclusion>
            <groupId>com.stuff</groupId>
            <artifactId>project-trans</artifactId>
          </exclusion>
        </exclusions>
        <dependency>
          <groupId>com.stuff</groupId>
          <artifactId>project1</artifactId>
          <version>1.0</version>
        <dependency>
        <dependency>
          <groupId>com.stuff</groupId>
          <artifactId>project2</artifactId>
          <version>1.0</version>
        <dependency>
      </dependencies>
      

      In this example, the "project-trans" dependency would be exluded from both project1 and project2. It can be difficult to find all the locations of a transitively included dependency for a large project that has a large number of frequently changing dependencies.

        Issue Links

          Activity

          Hide
          Paul Gier added a comment -

          For consistency, this syntax for exclusion could also be added to the plugin dependency to resolve issue: MNG-2163

          Show
          Paul Gier added a comment - For consistency, this syntax for exclusion could also be added to the plugin dependency to resolve issue: MNG-2163
          Hide
          Brett Porter added a comment -

          I can't see the difference between this and MNG-1977 - please re-open and clarify if that's the case.

          Show
          Brett Porter added a comment - I can't see the difference between this and MNG-1977 - please re-open and clarify if that's the case.
          Hide
          Paul Gier added a comment -

          I think this issue is more of a subset of MNG-1977 than a duplicate. Since MNG-1977 describes several issues related to transitive dependencies, it seems a bit broad to me. If it was already fixed, I would say that this is a duplicate. But the way it is now, I think keeping this issue open might provide an easier path to resolving this specific issue. If I have some time in the future I'll try to work on a patch for this issue, but I don't want to address everything in MNG-1977.

          Show
          Paul Gier added a comment - I think this issue is more of a subset of MNG-1977 than a duplicate. Since MNG-1977 describes several issues related to transitive dependencies, it seems a bit broad to me. If it was already fixed, I would say that this is a duplicate. But the way it is now, I think keeping this issue open might provide an easier path to resolving this specific issue. If I have some time in the future I'll try to work on a patch for this issue, but I don't want to address everything in MNG-1977 .
          Hide
          Charles Canning added a comment -

          A way to probably attempt this without changing model in the pom would be to add an exclusion scope. So, something like

          <dependency>
          <groupId>junit</groupId>
          <artifactId>junit</artifactId>
          <version>3.8.1</version>
          <scope>exclusion</scope>
          </dependency>

          Not sure if this applies to the older bug or not.

          Show
          Charles Canning added a comment - A way to probably attempt this without changing model in the pom would be to add an exclusion scope. So, something like <dependency> <groupId>junit</groupId> <artifactId>junit</artifactId> <version>3.8.1</version> <scope>exclusion</scope> </dependency> Not sure if this applies to the older bug or not.
          Show
          Jason van Zyl added a comment - Please refer to https://cwiki.apache.org/confluence/display/MAVEN/The+Great+JIRA+Cleanup+of+2014
          Hide
          Jason van Zyl added a comment -

          Please refer to https://cwiki.apache.org/confluence/display/MAVEN/The+Great+JIRA+Cleanup+of+2014 if you're wondering why this issue was closed out.

          Show
          Jason van Zyl added a comment - Please refer to https://cwiki.apache.org/confluence/display/MAVEN/The+Great+JIRA+Cleanup+of+2014 if you're wondering why this issue was closed out.

            People

            • Assignee:
              Unassigned
              Reporter:
              Paul Gier
            • Votes:
              31 Vote for this issue
              Watchers:
              31 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: