Maven
  1. Maven
  2. MNG-2315

Add option to exclude all transitive dependencies for a particular one

    Details

    • Type: New Feature New Feature
    • Status: Closed Closed
    • Priority: Critical Critical
    • Resolution: Fixed
    • Affects Version/s: 2.0.4
    • Fix Version/s: 3.2.1
    • Component/s: Dependencies
    • Labels:
      None
    • Complexity:
      Intermediate
    • Number of attachments :
      1

      Description

      Something like

      <dependency>
      ...
      <excludeTransitive>true</excludeTransitive>
      </dependency>

        Issue Links

          Activity

          Hide
          Blaine Simpson added a comment -

          Always years behind Ivy for anything to do with dependency specifications.

          Show
          Blaine Simpson added a comment - Always years behind Ivy for anything to do with dependency specifications.
          Hide
          Lo-Tan added a comment -

          I have come across this and found it would be useful as well. The use case for us was all of our projects build normally (EAR + skinny WARs), but when we get to the final deployment, our resulting EAR file contains only the libraries we create. We put all the third party libraries into a shared Java EE library (running WebLogic server) and thus, in the EAR we have to exclude all the transitives from all of our projects It's harsh to have to do it for each and every transitive.

          Show
          Lo-Tan added a comment - I have come across this and found it would be useful as well. The use case for us was all of our projects build normally (EAR + skinny WARs), but when we get to the final deployment, our resulting EAR file contains only the libraries we create. We put all the third party libraries into a shared Java EE library (running WebLogic server) and thus, in the EAR we have to exclude all the transitives from all of our projects It's harsh to have to do it for each and every transitive.
          Hide
          Samuel Langlois added a comment -

          Like the 134 other people who voted for it, I'd love to see this implemented.
          There are quite a few bad poms in Central, especially for old artifacts, and they will be here forever.

          In case you haven't seen it on MNG-3832, a workaround is to use wildcard on exclusion:

          <exclusion>
            <groupId>*</groupId>
            <artifactId>*</artifactId>
          </exclusion>
          

          It works in Maven 3, although it produces a nasty warning about threatened build stability and support in future versions.

          I guess the fix could simply be to remove this warning...

          Show
          Samuel Langlois added a comment - Like the 134 other people who voted for it, I'd love to see this implemented. There are quite a few bad poms in Central, especially for old artifacts, and they will be here forever. In case you haven't seen it on MNG-3832 , a workaround is to use wildcard on exclusion: <exclusion> <groupId>*</groupId> <artifactId>*</artifactId> </exclusion> It works in Maven 3, although it produces a nasty warning about threatened build stability and support in future versions. I guess the fix could simply be to remove this warning...
          Hide
          Robert Balazsi added a comment -

          Ok, I removed the warning messages, please find the patch attached.

          I solved it by updating the DefaultModelValidator class so that its ID_REGEX constant would include the '*' character. Also updated its corresponding unit test, DefaultModelValidatorTest.

          I also find this "<transientDepth>" idea useful and I'm actually planning to implement it. I will provide updates on my progress.

          Show
          Robert Balazsi added a comment - Ok, I removed the warning messages, please find the patch attached. I solved it by updating the DefaultModelValidator class so that its ID_REGEX constant would include the '*' character. Also updated its corresponding unit test, DefaultModelValidatorTest. I also find this "<transientDepth>" idea useful and I'm actually planning to implement it. I will provide updates on my progress.
          Hide
          Robert Scholte added a comment -

          Fixed as part of MNG-3832.
          This means: to exclude all transitive dependencies, specify:

            <exclusion>
              <groupId>*</groupId>
              <artifactId>*</artifactId>
            </exclusion>
          

          This has been added with the first versions of Maven3 due to its implementation by Aether.

          Adding new elements to the pom.xml is tricky, since a lot of tools and frameworks already depend on the current structure of the POM.
          The wildcard construction is just as strong as the suggested element <excludeTransitive/>, without XML Schema changes.

          Show
          Robert Scholte added a comment - Fixed as part of MNG-3832 . This means: to exclude all transitive dependencies, specify: <exclusion> <groupId> * </groupId> <artifactId> * </artifactId> </exclusion> This has been added with the first versions of Maven3 due to its implementation by Aether. Adding new elements to the pom.xml is tricky, since a lot of tools and frameworks already depend on the current structure of the POM. The wildcard construction is just as strong as the suggested element <excludeTransitive/> , without XML Schema changes.

            People

            • Assignee:
              Robert Scholte
              Reporter:
              Carlos Sanchez
            • Votes:
              160 Vote for this issue
              Watchers:
              112 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: