微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

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

我正在运行一个包含较新版本的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>

注意图案末尾的点.

原文地址:https://www.jb51.cc/java/130060.html

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。

相关推荐