gpt4 book ai didi

java - 为什么使用 maven shade 插件重定位不起作用?

转载 作者:可可西里 更新时间:2023-11-01 14:13:56 25 4
gpt4 key购买 nike

我有 some trouble运行的 Hadoop 作业包含比 Hadoop 发行版 (CDH 5.2) 中包含的版本更新的 Guava 版本。这是一个已知问题。我试着解决它by shading the libraries使用 Maven 阴影插件。因此,我将以下几行添加到我的 pom.xml 中:

  <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>
<configuration>
<relocations>
<relocation>
<pattern>com.google</pattern>
<shadedPattern>thirdparty.com.google</shadedPattern>
</relocation>
</relocations>
</configuration>
</execution>
</executions>
</plugin>

不幸的是,阴影似乎不起作用。当我提取 uber-JAR 时,没有文件夹 thirdparty/com/google 但仍然是文件夹 com/google

有人知道出了什么问题吗?

最佳答案

这对我有用:

<relocations>
<relocation>
<pattern>com.google.</pattern>
<shadedPattern>thirdparty.com.google.</shadedPattern>
</relocation>
</relocations>

注意模式末尾的点。

关于java - 为什么使用 maven shade 插件重定位不起作用?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27535909/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com