Using shaded jar as dependency causing shading in original project

Viewed 633

My project has a dependency on another project's shaded jar. This other project is using shade plugin to relocate all classes in package a.b.c for some artifact A version 1 to shaded.a.b.c.

My project also uses this artifact A but version 2. When I build my project, I see the import statement for a.b.c.d (which I expect to come from artifact A version 2 and is not present in artifact A version 1) in my project have been to changed to shaded.a.b.c.d. I am not using shading in my original project, however I see the shading plugin in dependency jar is causing the shading in my original project.

Is this expected behaviour? Is there a way through which we can stop this transitive shading?

Shade plugin of other project:

<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-shade-plugin</artifactId>
    <version>2.3</version>
    <executions>
        <execution>
            <phase>package</phase>
            <goals>
                <goal>shade</goal>
            </goals>
        </execution>
    </executions>
    <configuration>
        <shadedArtifactAttached>false</shadedArtifactAttached>
        <outputDirectory>${project.build.directory}</outputDirectory>
        <createDependencyReducedPom>true</createDependencyReducedPom>
        <promoteTransitiveDependencies>true</promoteTransitiveDependencies>
        <shadeSourcesContent>true</shadeSourcesContent>
        <relocations>
            <relocation>
                <pattern>a.b.c</pattern>
                <shadedPattern>shaded.a.b.c</shadedPattern>
            </relocation>
        </relocations>
    </configuration>
</plugin>
1 Answers
Related