flink任务jar包冲突解决方案 maven项目protobuf-java的jar包和集群上的jar包冲突解决方案

pom中解决冲突后,上传至集群,偶尔成功,偶尔jar包冲突,原因:集群是jvm的类加载器是随机加载的,所以将pom中打包的时候对相关jar包进行重命名,问题解决

<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-shade-plugin</artifactId>
    <version>3.1.0</version>
    <executions>
        <execution>
            <phase>package</phase>
            <goals>
                <goal>shade</goal>
            </goals>
            <configuration>
                <relocations>
                    <relocation>
                        <pattern>com.google.protobuf</pattern>
                        <shadedPattern>org.apache.flink.shaded.rename.com.google.protobuf</shadedPattern>
                    </relocation>
                </relocations>
            </configuration>
        </execution>
    </executions>
</plugin>

猜你喜欢

转载自blog.csdn.net/weixin_43015677/article/details/131251801