maven hive exec与protobuf冲突

b0zn9rqh  于 2021-06-28  发布在  Hive
关注(0)|答案(0)|浏览(411)

我是maven的新手。在我的项目中,我发现hive exec与protobuf冲突。下面是我的项目中的pom。

<dependencies>
    <dependency>
        <groupId>org.apache.hive</groupId>
        <artifactId>hive-exec</artifactId>
        <version>0.13.0.2.1.7.0-784</version>
    </dependency>
    <dependency>
        <groupId>com.google.protobuf</groupId>
        <artifactId>protobuf-java</artifactId>
        <scope>compile</scope>
        <version>3.1.0</version>
    </dependency>
</dependencies>

所以我深入研究 hive-exec . 我发现它使用的是maven shade插件。我猜是用来 Package Hive执行罐的。下面是hive-exec.pom中的相关代码:

<plugin>
    <artifactId>maven-shade-plugin</artifactId>
    <executions>
      <execution>
        <id>build-exec-bundle</id>
        <phase>package</phase>
        <goals>
          <goal>shade</goal>
        </goals>
        <configuration>
          <artifactSet>
            <includes>
              ...
              <include>com.google.protobuf:protobuf-java</include>
              ...
            </includes>
          </artifactSet>
          <relocations>
            <relocation>
              <pattern>com.esotericsoftware</pattern>
              <shadedPattern>org.apache.hive.com.esotericsoftware</shadedPattern>
            </relocation>
          </relocations>
        </configuration>
      </execution>
    </executions>
  </plugin>

还有(我不知道这个配置文件是怎么工作的):

<profile>
  <id>protobuf</id>
  <build>
    <plugins>
      <plugin>
        <artifactId>maven-antrun-plugin</artifactId>
        <executions>
          <execution>
            <id>generate-protobuf-sources</id>
            <phase>generate-sources</phase>
            <goals>
              <goal>run</goal>
            </goals>
            <configuration>
              <target>
                <property />
                <property />
                <echo>Building ORC Protobuf</echo>
                <mkdir />
                <exec>
                  <arg />
                  <arg />
                  <arg />
                </exec>
              </target>
            </configuration>
          </execution>
        </executions>
      </plugin>
    </plugins>
  </build>
</profile>

这里有一个吉拉应该是相关的。
我的问题是:
如何排除内置protobuff,并用protobuff 3.1.0重写类?看起来很正常 <excludes> 在这种情况下不起作用。
如果我不能重写它,我怎么能找到protobuff类的版本呢?我在hive-exec.pom里找不到。
非常感谢!!

暂无答案!

目前还没有任何答案,快来回答吧!

相关问题