[ 
https://issues.apache.org/jira/browse/MSHADE-267?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16586518#comment-16586518
 ] 

Jens Bannmann commented on MSHADE-267:
--------------------------------------

Yes, I applied a workaround with [this 
commit|https://github.com/elgashu/elgashu/commit/513a6b21bae95c45ccdaef3c614515439ae10129].
 It's not a reduced test case, though.

You can also check out tag 0.1.2 (with the bug) and 0.2 (with the workaround).

> Transitive dependencies of test dependencies included in shaded jar
> -------------------------------------------------------------------
>
>                 Key: MSHADE-267
>                 URL: https://issues.apache.org/jira/browse/MSHADE-267
>             Project: Maven Shade Plugin
>          Issue Type: Bug
>    Affects Versions: 2.1, 3.1.0
>            Reporter: Jens Bannmann
>            Priority: Major
>
> My project includes a {{test}} dependency to {{org.testng:testng}}, which has 
> a bunch of {{compile}} and {{test}} dependencies:
> {code}
> com.github.elgashu:elgashu:jar:0.2-SNAPSHOT
> +- 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
> {code}
> 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|https://maven.apache.org/guides/introduction/introduction-to-dependency-mechanism.html#Dependency_Scope]
>  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
(v7.6.3#76005)

Reply via email to