【发布时间】:2017-12-16 09:12:37
【问题描述】:
我的项目依赖于另一个项目的阴影 jar。这个另一个项目正在使用shade插件将包a.b.c中的所有类重新定位为artifact A version 1到shaded.a.b.c。
我的项目也使用了这个artifact A but version 2。当我构建我的项目时,我看到我的项目中a.b.c.d 的导入语句(我希望来自artifact A version 2 并且不存在于artifact A version 1 中)已更改为shaded.a.b.c.d。我没有在我的原始项目中使用阴影,但是我看到依赖 jar 中的阴影插件导致我的原始项目中的阴影。
这是预期的行为吗?有没有办法阻止这种传递阴影?
其他项目的Shade插件:
<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>
【问题讨论】:
标签: java maven maven-shade-plugin