You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@flink.apache.org by wa...@apache.org on 2022/03/04 15:25:22 UTC
[flink-kubernetes-operator] branch main updated: [FLINK-26476] Introduce flink-kubernetes-shaded to avoid overlapping classes
This is an automated email from the ASF dual-hosted git repository.
wangyang0918 pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/flink-kubernetes-operator.git
The following commit(s) were added to refs/heads/main by this push:
new 721a868 [FLINK-26476] Introduce flink-kubernetes-shaded to avoid overlapping classes
721a868 is described below
commit 721a8680e395d64bbf0290c5faedeeb73353b0cc
Author: wangyang0918 <da...@alibaba-inc.com>
AuthorDate: Fri Mar 4 11:56:59 2022 +0800
[FLINK-26476] Introduce flink-kubernetes-shaded to avoid overlapping classes
This closes #40.
---
.github/workflows/ci.yml | 14 ++++++-
Dockerfile | 2 +
flink-kubernetes-operator/pom.xml | 57 ++++++++++++++++++++++++++-
flink-kubernetes-shaded/pom.xml | 81 +++++++++++++++++++++++++++++++++++++++
pom.xml | 42 +-------------------
5 files changed, 151 insertions(+), 45 deletions(-)
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index 6f3345a..269010b 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -32,7 +32,12 @@ jobs:
java-version: '11'
distribution: 'adopt'
- name: Build with Maven
- run: mvn clean install
+ run: |
+ mvn clean install | tee ./mvn.log
+ if [[ $(grep -c "overlapping classes" ./mvn.log) -gt 0 ]];then
+ echo "Found overlapping classes, please fix"
+ exit 1
+ fi
- name: Start minikube
run: |
source e2e-tests/utils.sh
@@ -82,7 +87,12 @@ jobs:
java-version: '11'
distribution: 'adopt'
- name: Build with Maven
- run: mvn clean install
+ run: |
+ mvn clean install | tee ./mvn.log
+ if [[ $(grep -c "overlapping classes" ./mvn.log) -gt 0 ]];then
+ echo "Found overlapping classes, please fix"
+ exit 1
+ fi
- name: Start minikube
run: |
source e2e-tests/utils.sh
diff --git a/Dockerfile b/Dockerfile
index f36d744..c9f8f9a 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -19,12 +19,14 @@
FROM maven:3.8.4-openjdk-11 AS build
WORKDIR /app
+ENV SHADED_DIR=flink-kubernetes-shaded
ENV OPERATOR_DIR=flink-kubernetes-operator
ENV WEBHOOK_DIR=flink-kubernetes-webhook
RUN mkdir $OPERATOR_DIR $WEBHOOK_DIR
COPY pom.xml .
+COPY $SHADED_DIR/pom.xml ./$SHADED_DIR/
COPY $WEBHOOK_DIR/pom.xml ./$WEBHOOK_DIR/
COPY $OPERATOR_DIR/pom.xml ./$OPERATOR_DIR/
diff --git a/flink-kubernetes-operator/pom.xml b/flink-kubernetes-operator/pom.xml
index 8cb2d67..b32339b 100644
--- a/flink-kubernetes-operator/pom.xml
+++ b/flink-kubernetes-operator/pom.xml
@@ -65,8 +65,53 @@ under the License.
<dependency>
<groupId>org.apache.flink</groupId>
- <artifactId>flink-kubernetes_${scala.version}</artifactId>
- <version>${flink.version}</version>
+ <artifactId>flink-kubernetes-shaded</artifactId>
+ <version>${project.version}</version>
+ <exclusions>
+ <exclusion>
+ <groupId>*</groupId>
+ <artifactId>*</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+
+ <dependency>
+ <groupId>org.projectlombok</groupId>
+ <artifactId>lombok</artifactId>
+ <version>${lombok.version}</version>
+ <scope>provided</scope>
+ </dependency>
+
+ <!-- Logging -->
+
+ <dependency>
+ <groupId>org.slf4j</groupId>
+ <artifactId>slf4j-api</artifactId>
+ <version>${slf4j.version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.logging.log4j</groupId>
+ <artifactId>log4j-slf4j-impl</artifactId>
+ <version>${log4j.version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.logging.log4j</groupId>
+ <artifactId>log4j-api</artifactId>
+ <version>${log4j.version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.logging.log4j</groupId>
+ <artifactId>log4j-core</artifactId>
+ <version>${log4j.version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.logging.log4j</groupId>
+ <artifactId>log4j-1.2-api</artifactId>
+ <version>${log4j.version}</version>
</dependency>
<!-- Test -->
@@ -124,6 +169,14 @@ under the License.
</goals>
<configuration combine.children="append">
<shadedArtifactAttached>true</shadedArtifactAttached>
+ <filters combine.children="append">
+ <filter>
+ <artifact>*:*</artifact>
+ <excludes>
+ <exclude>META-INF/**/module-info.class</exclude>
+ </excludes>
+ </filter>
+ </filters>
<artifactSet>
<includes combine.children="append">
<include>*:*</include>
diff --git a/flink-kubernetes-shaded/pom.xml b/flink-kubernetes-shaded/pom.xml
new file mode 100644
index 0000000..9a3002a
--- /dev/null
+++ b/flink-kubernetes-shaded/pom.xml
@@ -0,0 +1,81 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements. See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership. The ASF licenses this file
+to you under the Apache License, Version 2.0 (the
+"License"); you may not use this file except in compliance
+with the License. You may obtain a copy of the License at
+ http://www.apache.org/licenses/LICENSE-2.0
+Unless required by applicable law or agreed to in writing,
+software distributed under the License is distributed on an
+"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+KIND, either express or implied. See the License for the
+specific language governing permissions and limitations
+under the License.
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+
+ <parent>
+ <groupId>org.apache.flink</groupId>
+ <artifactId>flink-kubernetes-operator-parent</artifactId>
+ <version>1.0-SNAPSHOT</version>
+ <relativePath>..</relativePath>
+ </parent>
+
+ <artifactId>flink-kubernetes-shaded</artifactId>
+ <name>Flink Kubernetes Shaded</name>
+ <packaging>jar</packaging>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.flink</groupId>
+ <artifactId>flink-kubernetes_${scala.version}</artifactId>
+ <version>${flink.version}</version>
+ <exclusions>
+ <exclusion>
+ <groupId>*</groupId>
+ <artifactId>*</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-shade-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>shade-flink-operator</id>
+ <phase>package</phase>
+ <goals>
+ <goal>shade</goal>
+ </goals>
+ <configuration combine.children="append">
+ <artifactSet>
+ <includes combine.children="append">
+ <include>*:*</include>
+ </includes>
+ </artifactSet>
+ <transformers>
+ <transformer implementation="org.apache.maven.plugins.shade.resource.ServicesResourceTransformer" />
+ </transformers>
+ <relocations>
+ <relocation>
+ <pattern>io.fabric8</pattern>
+ <shadedPattern>org.apache.flink.kubernetes.shaded.io.fabric8</shadedPattern>
+ </relocation>
+ </relocations>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+</project>
diff --git a/pom.xml b/pom.xml
index 261bd57..3fbda29 100644
--- a/pom.xml
+++ b/pom.xml
@@ -45,6 +45,7 @@ under the License.
</licenses>
<modules>
+ <module>flink-kubernetes-shaded</module>
<module>flink-kubernetes-operator</module>
<module>flink-kubernetes-webhook</module>
</modules>
@@ -72,47 +73,6 @@ under the License.
<it.skip>true</it.skip>
</properties>
- <dependencies>
- <dependency>
- <groupId>org.projectlombok</groupId>
- <artifactId>lombok</artifactId>
- <version>${lombok.version}</version>
- <scope>provided</scope>
- </dependency>
-
- <!-- Logging -->
-
- <dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-api</artifactId>
- <version>${slf4j.version}</version>
- </dependency>
-
- <dependency>
- <groupId>org.apache.logging.log4j</groupId>
- <artifactId>log4j-slf4j-impl</artifactId>
- <version>${log4j.version}</version>
- </dependency>
-
- <dependency>
- <groupId>org.apache.logging.log4j</groupId>
- <artifactId>log4j-api</artifactId>
- <version>${log4j.version}</version>
- </dependency>
-
- <dependency>
- <groupId>org.apache.logging.log4j</groupId>
- <artifactId>log4j-core</artifactId>
- <version>${log4j.version}</version>
- </dependency>
-
- <dependency>
- <groupId>org.apache.logging.log4j</groupId>
- <artifactId>log4j-1.2-api</artifactId>
- <version>${log4j.version}</version>
- </dependency>
- </dependencies>
-
<build>
<plugins>
<plugin>