You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@maven.apache.org by "Yana Vasileva (Jira)" <ji...@apache.org> on 2020/07/07 07:13:00 UTC
[jira] [Created] (MSHADE-374) Exclude test shading when
shadeTestJar is enabled
Yana Vasileva created MSHADE-374:
------------------------------------
Summary: Exclude test shading when shadeTestJar is enabled
Key: MSHADE-374
URL: https://issues.apache.org/jira/browse/MSHADE-374
Project: Maven Shade Plugin
Issue Type: Task
Affects Versions: 3.2.4, 3.2.3
Reporter: Yana Vasileva
*Scenario:*
* Plugin version - 3.2.3 (I tried with 3.2.4 as well)
* Maven version - 3.2.5 (old one, so I tried with 3.6.3 as well - same result)
* Project A shades some libraries - `httpclient`, `commons-coded`, `commons-logging`
* {{shadeTestJar}} is enabled so the created `projectA-tests.jar` can resolve the shaded source classes
* The plugin configuration looks similar to the following:
{code:java}
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<configuration>
<promoteTransitiveDependencies>false</promoteTransitiveDependencies>
<createSourcesJar>true</createSourcesJar>
<createDependencyReducedPom>true</createDependencyReducedPom>
<keepDependenciesWithProvidedScope>true</keepDependenciesWithProvidedScope>
<relocations>
<relocation>
<pattern>org.apache.http</pattern>
<shadedPattern>myjar.impl.org.apache.http</shadedPattern>
</relocation>
<relocation>
<pattern>org.apache.commons.codec</pattern>
<shadedPattern>myjar.impl.org.apache.commons.codec</shadedPattern>
</relocation>
<relocation>
<pattern>org.apache.commons.logging</pattern>
<shadedPattern>myjar.impl.org.apache.commons.logging</shadedPattern>
</relocation>
</relocations>
<transformers>
<transformer implementation="org.apache.maven.plugins.shade.resource.ServicesResourceTransformer" />
</transformers>
<shadeTestJar>true</shadeTestJar>
</configuration>
</plugin>
{code}
As a result, `projectA-tests.jar` includes the shaded classes from the `commons-codec-tests.jar` and `commons-logging-tests.jar` which cause troubles when some of the tests scenarios are being executed for project A.
*Question:*
Is it possible to exclude the classes of `commons-*-tests.jar` and prevent their shading in the `projectA-tests.jar`?
I tried the following as it is documented [here|https://maven.apache.org/plugins/maven-shade-plugin/examples/includes-excludes.html], however, the classes are still shaded:
{code:java}
<artifactSet>
<excludes>
<exclude>commons-codec:commons-codec:tests</exclude>
<exclude>commons-logging:commons-logging:tests</exclude>
</excludes>
</artifactSet>
{code}
Is the observed behavior expected? Is there any way to exclude the tests shading?
Any help is highly appreciated, please let me know if I need to provide some further information.
--
This message was sent by Atlassian Jira
(v8.3.4#803005)