Uploaded image for project: 'Maven Assembly Plugin'
  1. Maven Assembly Plugin
  2. MASSEMBLY-762

Assembly plugin doesn't exclude transitive dependencies when excluded by wildcards in dependencies section

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 2.5.3
    • 3.1.1
    • dependencySet
    • None

    Description

      On goal assembly:single with pom file:

      <?xml version="1.0" encoding="UTF-8"?>
      <project xmlns="http://maven.apache.org/POM/4.0.0"
               xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
               xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
          <modelVersion>4.0.0</modelVersion>
      
          <groupId>MyTests</groupId>
          <artifactId>Tests</artifactId>
          <packaging>pom</packaging>
          <version>1.0-SNAPSHOT</version>
      
          <dependencies>
              <dependency>
                  <groupId>org.springframework</groupId>
                  <artifactId>spring-core</artifactId>
                  <version>4.1.0.RELEASE</version>
                  <exclusions>
                      <exclusion>
                          <groupId>*</groupId>
                          <artifactId>*</artifactId>
                      </exclusion>
                  </exclusions>
              </dependency>
          </dependencies>
          <build>
              <plugins>
                  <plugin>
                      <groupId>org.apache.maven.plugins</groupId>
                      <artifactId>maven-assembly-plugin</artifactId>
                      <version>2.5.3</version>
                      <configuration>
                          <descriptorRefs>
                              <descriptorRef>jar-with-dependencies</descriptorRef>
                          </descriptorRefs>
                      </configuration>
                  </plugin>
              </plugins>
          </build>
      </project>
      

      transitive dependency commons-logging appears in resulting jar.
      When wildcard is replaced with specific dependency:

          <dependencies>
              <dependency>
                  <groupId>org.springframework</groupId>
                  <artifactId>spring-core</artifactId>
                  <version>4.1.0.RELEASE</version>
                  <exclusions>
                      <exclusion>
                          <groupId>commons-logging</groupId>
                          <artifactId>commons-logging</artifactId>
                      </exclusion>
                  </exclusions>
              </dependency>
          </dependencies>
      </project>
      

      the plugin works as expected and doesn't add this dependency.

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              dmgburg Denis Goihburg
              Votes:
              10 Vote for this issue
              Watchers:
              8 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: