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

Create an integration test to capture effects of exclusions from dependency management in combination with exclusions from regular dependencies

    XMLWordPrintableJSON

Details

    • Task
    • Status: Closed
    • Major
    • Resolution: Fixed
    • None
    • None
    • Integration Tests
    • None

    Description

      Given this innocent POM snippet:

        <dependencyManagement>
          <dependencies>
            <dependency>
              <groupId>org.apache.maven</groupId>
              <artifactId>maven-model</artifactId>
              <version>2.0.6</version>
              <exclusions>
                <exclusion>
                  <groupId>org.codehaus.plexus</groupId>
                  <artifactId>plexus-utils</artifactId>
                </exclusion>
              </exclusions>
            </dependency>
          </dependencies>
        </dependencyManagement>
        <dependencies>
          <dependency>
            <groupId>org.apache.maven</groupId>
            <artifactId>maven-model</artifactId>
            <exclusions>
              <exclusion>
                <groupId>foo</groupId>
                <artifactId>bar</artifactId>
              </exclusion>
            </exclusions>
          </dependency>
        </dependencies>
      

      What will be the effective exclusions applied to the dependencies of maven-model?

      It depends on the context in which the POM is processed. Technically, the two exclusions are not merged in the effective POM (right now, the effective POM only propagates managed exclusions to a dependency if the dependency has no exclusions declared). However, for a local project POM, the artifact collector superimposes the exclusion of plexus-utils from the dependency management onto the maven-model artifact such that eventually both exclusions apply during dependency resolution. In contrast, for a dependency POM, this superimposition does not happen, such that exclusions from dependency management do not apply to dependencies that by themselves have already exclusions specified.

      Attachments

        Issue Links

          Activity

            People

              bentmann Benjamin Bentmann
              bentmann Benjamin Bentmann
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: