加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 编程开发 > Java > 正文

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

发布时间:2020-12-15 00:55:00 所属栏目:Java 来源:网络整理
导读:我正在运行一个包含较新版本的Guava的Hadoop作业的 some trouble,而不是Hadoop发行版中包含的版本(CDH 5.2).这是一个已知问题.我尝试使用Maven shade插件解决它 by shading the libraries.因此,我在pom.xml中添加了以下行: plugin groupIdorg.apache.maven.
我正在运行一个包含较新版本的Guava的Hadoop作业的 some trouble,而不是Hadoop发行版中包含的版本(CDH 5.2).这是一个已知问题.我尝试使用Maven shade插件解决它 by shading the libraries.因此,我在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>

注意图案末尾的点.

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读