maven-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jens Bannmann (JIRA)" <>
Subject [jira] [Created] (MSHADE-267) Transitive dependencies of test dependencies included in shaded jar
Date Mon, 13 Nov 2017 12:24:00 GMT
Jens Bannmann created MSHADE-267:

             Summary: Transitive dependencies of test dependencies included in shaded jar
                 Key: MSHADE-267
             Project: Maven Shade Plugin
          Issue Type: Bug
    Affects Versions: 3.1.0, 2.1
            Reporter: Jens Bannmann

My project includes a {{test}} dependency to {{org.testng:testng}}, which has a bunch of {{compile}}
and {{test}} dependencies:

+- org.testng:testng:jar:6.8:test
   +- junit:junit:jar:4.10:compile
   |  \- org.hamcrest:hamcrest-core:jar:1.1:compile
   +- org.beanshell:bsh:jar:2.0b4:test
   +- com.beust:jcommander:jar:1.27:test
   \- org.yaml:snakeyaml:jar:1.6:test

I use the Shade plugin to create a fat jar of my production code; I want neither my test code
nor its dependencies to end up in that fat jar.

However, while the Shade plugin correctly excludes {{org.testng:testng}} itself (due to the
{{test}} scope), its {{compile}} dependencies ({{junit:junit:jar}} and {{org.hamcrest:hamcrest-core}})
also end up in the shaded jar. This contradicts [Maven's rules for transitive dependency scoping|]
which say that {{compile}} dependencies of {{test}} dependencies turn into {{test}} as well.

The workaround would be to explicitly exclude each of those transitive dependencies (and their
transitive dependencies), but that effectively means manually tracking the dependency trees
of all upstream dependencies, which IMO is not feasible.

This message was sent by Atlassian JIRA

View raw message