You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@maven.apache.org by "William Bakker (JIRA)" <ji...@apache.org> on 2016/08/01 13:48:20 UTC

[jira] [Commented] (MSHADE-203) "shadeTestJar" option not working?

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

William Bakker commented on MSHADE-203:
---------------------------------------

We encountered the same issue. As the shade plugin only sees runtime dependencies, you need to add an compile scope dependency on the test-jar of the module that is to be shaded. This dependency can now be used by the maven-shade-plugin to generate not only a tests.jar, but also a test-sources.jar (the latter was also not yet available).

*Gist*

A patch (based on fork org.immutables.tools:maven-shade-plugin) has been logged at https://gist.github.com/wjbakker/1233dd050bf7f8e52f34fdc3ffbfc3ec

> "shadeTestJar" option not working?
> ----------------------------------
>
>                 Key: MSHADE-203
>                 URL: https://issues.apache.org/jira/browse/MSHADE-203
>             Project: Maven Shade Plugin
>          Issue Type: Bug
>    Affects Versions: 2.4.1
>            Reporter: Aaron Curley
>            Priority: Minor
>
> So, I'm pretty new to using the maven-shade-plugin and I'm not really that familiar with the maven-shade-plugin's design/code; however, it appears that the <shadeTestJar> option in the maven-shade-plugin configuration does not work correctly.  
> __Symtoms__
> While running "mvn package" in my project (which has <shadeTestJar> set to true), maven-shade-plugin appears to perform the "test jar shading" step (after performing the regular jar's shade), but the "shaded" test JAR doesn't actually include any shaded dependency files (it just includes the "original" test jar's contents, which is essentially a "no-op").
> __Possible Diagnosis__
> I took a quick look at the release code base for v2.4.1, in particularly, the mojo/ShadeMojo.java file.  In the execute() method, at line 437, there is method call:
> processArtifactSelectors( artifacts, artifactIds, sourceArtifacts, artifactSelector );
> This method call appears to populate the "artifacts" and "sourceArtifacts" sets created earlier in execute() but the code noticeably does not populate the similar "testArtifacts" set.  My guess is that this is causing the "shade" operation to skip processing any artifacts for the test jar shade operation (since only the project-level artifact is populated in the "testArtifacts" set at line 432).
> __Possible Solution__
> (Obviously) Add an additional parameter to processArtifactSelectors() that accepts the additional "testArtifacts" set.  Then, processArtifactSelectors could populate that set (much like it does for the "sourceArtifacts" set at line 623).  A more extensible design might be to populate a list of Set's and supply that to processArtifactSelectors(), but there are some other difficulties with that (under the current design).
> Best wishes.  Like I said, I'm pretty new to this plugin, so the above may be incorrect.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)