Jeff Maxwell created MNG-7949:
---------------------------------

             Summary: Dependency management import should support explicit 
inclusion
                 Key: MNG-7949
                 URL: https://issues.apache.org/jira/browse/MNG-7949
             Project: Maven
          Issue Type: Improvement
          Components: Dependencies
            Reporter: Jeff Maxwell


There are many cases where a project will publish a bom that has a mix of that 
project's artifacts and 3rd party ones.

While the exclusion feature is an improvement in scenarios where one wants to 
limit the dependencies to just those owned by the project the exclusion list 
can be quite large and would require updating whenever the project adds another 
3rd party dependency.

Example:

Suppose we wanted to exclude all non-spring dependencies from 
{{org.springframework.boot:spring-boot-dependencies}} with {{exclusions}} a 
reasonable attempt, one that would retain clarity, would take 172 lines with 
{{includes}} it would take 12.
{code:java}
      <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-dependencies</artifactId>
        <version>${spring-boot.version}</version>
        <type>pom</type>
        <scope>import</scope>
        <exclusions>
          <exclusion>
            <groupId>ch*</groupId>
          </exclusion>
          <exclusion>
            <groupId>co*</groupId>
          </exclusion>
          <exclusion>
            <groupId>io.*</groupId>
          </exclusion>
          <exclusion>
            <groupId>jakarta*</groupId>
          </exclusion>
          <exclusion>
            <groupId>javax*</groupId>
          </exclusion>
          <exclusion>
            <groupId>jaxen*</groupId>
          </exclusion>
          <exclusion>
            <groupId>junit*</groupId>
          </exclusion>
          <exclusion>
            <groupId>net*</groupId>
          </exclusion>
          <exclusion>
            <groupId>nz*</groupId>
          </exclusion>
          <exclusion>
            <groupId>org.apache*</groupId>
          </exclusion>
          <exclusion>
            <groupId>org.aspectj*</groupId>
          </exclusion>
          <exclusion>
            <groupId>org.assertj*</groupId>
          </exclusion>
          <exclusion>
            <groupId>org.awaitility*</groupId>
          </exclusion>
          <exclusion>
            <groupId>org.cache2k*</groupId>
          </exclusion>
          <exclusion>
            <groupId>org.codehaus.janino*</groupId>
          </exclusion>
          <exclusion>
            <groupId>org.crac*</groupId>
          </exclusion>
          <exclusion>
            <groupId>org.eclipse*</groupId>
          </exclusion>
          <exclusion>
            <groupId>org.ehcache*</groupId>
          </exclusion>
          <exclusion>
            <groupId>org.elasticsearch.client*</groupId>
          </exclusion>
          <exclusion>
            <groupId>org.firebirdsql.jdbc*</groupId>
          </exclusion>
          <exclusion>
            <groupId>org.flywaydb*</groupId>
          </exclusion>
          <exclusion>
            <groupId>org.freemarker*</groupId>
          </exclusion>
          <exclusion>
            <groupId>org.glassfish*</groupId>
          </exclusion>
          <exclusion>
            <groupId>org.hamcrest*</groupId>
          </exclusion>
          <exclusion>
            <groupId>org.hibernate*</groupId>
          </exclusion>
          <exclusion>
            <groupId>org.hsqldb*</groupId>
          </exclusion>
          <exclusion>
            <groupId>org.infinispan*</groupId>
          </exclusion>
          <exclusion>
            <groupId>org.influxdb*</groupId>
          </exclusion>
          <exclusion>
            <groupId>org.jboss.logging*</groupId>
          </exclusion>
          <exclusion>
            <groupId>org.jdom*</groupId>
          </exclusion>
          <exclusion>
            <groupId>org.jetbrains*</groupId>
          </exclusion>
          <exclusion>
            <groupId>org.jooq*</groupId>
          </exclusion>
          <exclusion>
            <groupId>org.junit*</groupId>
          </exclusion>
          <exclusion>
            <groupId>org.liquibase*</groupId>
          </exclusion>
          <exclusion>
            <groupId>org.mariadb*</groupId>
          </exclusion>
          <exclusion>
            <groupId>org.messaginghub*</groupId>
          </exclusion>
          <exclusion>
            <groupId>org.mockito*</groupId>
          </exclusion>
          <exclusion>
            <groupId>org.mongodb*</groupId>
          </exclusion>
          <exclusion>
            <groupId>org.neo4j.driver*</groupId>
          </exclusion>
          <exclusion>
            <groupId>org.postgresql*</groupId>
          </exclusion>
          <exclusion>
            <groupId>org.projectlombok*</groupId>
          </exclusion>
          <exclusion>
            <groupId>org.quartz-scheduler*</groupId>
          </exclusion>
          <exclusion>
            <groupId>org.reactivestreams*</groupId>
          </exclusion>
          <exclusion>
            <groupId>org.seleniumhq.selenium*</groupId>
          </exclusion>
          <exclusion>
            <groupId>org.skyscreamer*</groupId>
          </exclusion>
          <exclusion>
            <groupId>org.slf4j*</groupId>
          </exclusion>
          <exclusion>
            <groupId>org.testcontainers*</groupId>
          </exclusion>
          <exclusion>
            <groupId>org.thymeleaf*</groupId>
          </exclusion>
          <exclusion>
            <groupId>org.webjars*</groupId>
          </exclusion>
          <exclusion>
            <groupId>org.xerial*</groupId>
          </exclusion>
          <exclusion>
            <groupId>org.xmlunit*</groupId>
          </exclusion>
          <exclusion>
            <groupId>org.yaml*</groupId>
          </exclusion>
          <exclusion>
            <groupId>redis.clients*</groupId>
          </exclusion>
          <exclusion>
            <groupId>wsdl4j*</groupId>
          </exclusion>
        </exclusions>
      </dependency>{code}
vs:
{code:java}
      <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-dependencies</artifactId>
        <version>${spring-boot.version}</version>
        <type>pom</type>
        <scope>import</scope>
        <includes>
          <include>
            <groupId>org.springframework*</groupId>
          </include>
        </includes>
      </dependency>{code}
 



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to