flink-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From se...@apache.org
Subject [1/2] flink git commit: [FLINK-2584] Check for unshaded classes in fat jar and shade curator
Date Tue, 01 Sep 2015 09:53:29 GMT
Repository: flink
Updated Branches:
  refs/heads/master 7364ce180 -> 8c852c2ab


[FLINK-2584] Check for unshaded classes in fat jar and shade curator

This closes #1076


Project: http://git-wip-us.apache.org/repos/asf/flink/repo
Commit: http://git-wip-us.apache.org/repos/asf/flink/commit/8c852c2a
Tree: http://git-wip-us.apache.org/repos/asf/flink/tree/8c852c2a
Diff: http://git-wip-us.apache.org/repos/asf/flink/diff/8c852c2a

Branch: refs/heads/master
Commit: 8c852c2abf3a1e597dd1d139197d3420861a516c
Parents: f4a48c2
Author: Robert Metzger <rmetzger@apache.org>
Authored: Thu Aug 27 18:13:08 2015 +0200
Committer: Stephan Ewen <sewen@apache.org>
Committed: Tue Sep 1 11:53:03 2015 +0200

----------------------------------------------------------------------
 .../flink-storm-compatibility-core/pom.xml      |  5 ++
 flink-runtime/pom.xml                           |  5 +-
 flink-shaded-curator/pom.xml                    | 89 ++++++++++++++++++++
 .../flink-connector-elasticsearch/pom.xml       |  6 ++
 .../flink-connector-kafka/pom.xml               |  6 ++
 pom.xml                                         |  1 +
 tools/travis_mvn_watchdog.sh                    | 23 +++++
 7 files changed, 133 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flink/blob/8c852c2a/flink-contrib/flink-storm-compatibility/flink-storm-compatibility-core/pom.xml
----------------------------------------------------------------------
diff --git a/flink-contrib/flink-storm-compatibility/flink-storm-compatibility-core/pom.xml
b/flink-contrib/flink-storm-compatibility/flink-storm-compatibility-core/pom.xml
index 92be9db..cced678 100644
--- a/flink-contrib/flink-storm-compatibility/flink-storm-compatibility-core/pom.xml
+++ b/flink-contrib/flink-storm-compatibility/flink-storm-compatibility-core/pom.xml
@@ -57,6 +57,11 @@ under the License.
 			</exclusions>
 		</dependency>
 
+		<dependency>
+			<groupId>com.google.guava</groupId>
+			<artifactId>guava</artifactId>
+			<version>${guava.version}</version>
+		</dependency>
 	</dependencies>
 
 	<build>

http://git-wip-us.apache.org/repos/asf/flink/blob/8c852c2a/flink-runtime/pom.xml
----------------------------------------------------------------------
diff --git a/flink-runtime/pom.xml b/flink-runtime/pom.xml
index c5706a1..5b8d0ca 100644
--- a/flink-runtime/pom.xml
+++ b/flink-runtime/pom.xml
@@ -193,8 +193,9 @@ under the License.
 		</dependency>
 
 		<dependency>
-			<groupId>org.apache.curator</groupId>
-			<artifactId>curator-recipes</artifactId>
+			<groupId>org.apache.flink</groupId>
+			<artifactId>flink-shaded-curator</artifactId>
+			<version>${project.version}</version>
 		</dependency>
 		
 		<dependency>

http://git-wip-us.apache.org/repos/asf/flink/blob/8c852c2a/flink-shaded-curator/pom.xml
----------------------------------------------------------------------
diff --git a/flink-shaded-curator/pom.xml b/flink-shaded-curator/pom.xml
new file mode 100644
index 0000000..3e3894a
--- /dev/null
+++ b/flink-shaded-curator/pom.xml
@@ -0,0 +1,89 @@
+<?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/maven-v4_0_0.xsd">
+
+	<modelVersion>4.0.0</modelVersion>
+
+	<parent>
+		<groupId>org.apache.flink</groupId>
+		<artifactId>flink-parent</artifactId>
+		<version>0.10-SNAPSHOT</version>
+		<relativePath>..</relativePath>
+	</parent>
+
+	<artifactId>flink-shaded-curator</artifactId>
+	<name>flink-shaded-curator</name>
+
+	<packaging>jar</packaging>
+
+
+	<dependencies>
+		<dependency>
+			<groupId>org.apache.curator</groupId>
+			<artifactId>curator-recipes</artifactId>
+			<version>${curator.version}</version>
+		</dependency>
+	</dependencies>
+
+	<build>
+		<plugins>
+			<!-- Relocate the Curator's Guava dependency into a different namespace and
+			put create our own apache curator dependency.
+			We can easily integrate curator's netty into the jar file.
+			-->
+			<plugin>
+				<groupId>org.apache.maven.plugins</groupId>
+				<artifactId>maven-shade-plugin</artifactId>
+				<executions>
+					<execution>
+						<id>shade-flink</id> <!-- override inherited execution id -->
+						<phase>package</phase>
+						<goals>
+							<goal>shade</goal>
+						</goals>
+						<configuration>
+							<shadedArtifactAttached>false</shadedArtifactAttached>
+							<createDependencyReducedPom>true</createDependencyReducedPom>
+							<dependencyReducedPomLocation>${project.basedir}/target/dependency-reduced-pom.xml</dependencyReducedPomLocation>
+							<transformers>
+								<!-- The service transformer is needed to merge META-INF/services files -->
+								<transformer implementation="org.apache.maven.plugins.shade.resource.ServicesResourceTransformer"/>
+								<transformer implementation="org.apache.maven.plugins.shade.resource.ApacheNoticeResourceTransformer"/>
+							</transformers>
+							<artifactSet>
+								<includes>
+									<include>org.apache.curator:*</include>
+									<include>com.google.guava:*</include>
+								</includes>
+							</artifactSet>
+							<relocations>
+								<relocation>
+									<pattern>com.google</pattern>
+									<shadedPattern>org.apache.curator.shaded.com.google</shadedPattern>
+								</relocation>
+							</relocations>
+						</configuration>
+					</execution>
+				</executions>
+			</plugin>
+		</plugins>
+	</build>
+</project>

http://git-wip-us.apache.org/repos/asf/flink/blob/8c852c2a/flink-staging/flink-streaming/flink-streaming-connectors/flink-connector-elasticsearch/pom.xml
----------------------------------------------------------------------
diff --git a/flink-staging/flink-streaming/flink-streaming-connectors/flink-connector-elasticsearch/pom.xml
b/flink-staging/flink-streaming/flink-streaming-connectors/flink-connector-elasticsearch/pom.xml
index ccce746..d4a009f 100644
--- a/flink-staging/flink-streaming/flink-streaming-connectors/flink-connector-elasticsearch/pom.xml
+++ b/flink-staging/flink-streaming/flink-streaming-connectors/flink-connector-elasticsearch/pom.xml
@@ -55,6 +55,12 @@ under the License.
         </dependency>
 
         <dependency>
+            <groupId>com.google.guava</groupId>
+            <artifactId>guava</artifactId>
+            <version>${guava.version}</version>
+        </dependency>
+
+        <dependency>
             <groupId>org.apache.flink</groupId>
             <artifactId>flink-streaming-core</artifactId>
             <version>${project.version}</version>

http://git-wip-us.apache.org/repos/asf/flink/blob/8c852c2a/flink-staging/flink-streaming/flink-streaming-connectors/flink-connector-kafka/pom.xml
----------------------------------------------------------------------
diff --git a/flink-staging/flink-streaming/flink-streaming-connectors/flink-connector-kafka/pom.xml
b/flink-staging/flink-streaming/flink-streaming-connectors/flink-connector-kafka/pom.xml
index bbbd2be..98d7f0d 100644
--- a/flink-staging/flink-streaming/flink-streaming-connectors/flink-connector-kafka/pom.xml
+++ b/flink-staging/flink-streaming/flink-streaming-connectors/flink-connector-kafka/pom.xml
@@ -93,6 +93,12 @@ under the License.
 		</dependency>
 
 		<dependency>
+			<groupId>com.google.guava</groupId>
+			<artifactId>guava</artifactId>
+			<version>${guava.version}</version>
+		</dependency>
+
+		<dependency>
 			<groupId>org.apache.curator</groupId>
 			<artifactId>curator-test</artifactId>
 			<version>2.7.1</version>

http://git-wip-us.apache.org/repos/asf/flink/blob/8c852c2a/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index 0e7f995..cdee6f6 100644
--- a/pom.xml
+++ b/pom.xml
@@ -51,6 +51,7 @@ under the License.
 
 	<modules>
 		<module>flink-shaded-hadoop</module>
+		<module>flink-shaded-curator</module>
 		<module>flink-core</module>
 		<module>flink-java</module>
 		<module>flink-scala</module>

http://git-wip-us.apache.org/repos/asf/flink/blob/8c852c2a/tools/travis_mvn_watchdog.sh
----------------------------------------------------------------------
diff --git a/tools/travis_mvn_watchdog.sh b/tools/travis_mvn_watchdog.sh
index 08cf6ef..629c44c 100755
--- a/tools/travis_mvn_watchdog.sh
+++ b/tools/travis_mvn_watchdog.sh
@@ -156,6 +156,27 @@ watchdog () {
 	done
 }
 
+# Check the final fat jar for illegal artifacts
+check_shaded_artifacts() {
+	jar tf build-target/lib/flink-dist-*.jar > allClasses
+	ASM=`cat allClasses | grep '^org/objectweb/asm/' | wc -l`
+	if [ $ASM != "0" ]; then
+		echo "=============================================================================="
+		echo "Detected $ASM asm dependencies in fat jar"
+		echo "=============================================================================="
+		exit 1
+	fi
+	 
+	GUAVA=`cat allClasses | grep '^com/google/common' | wc -l`
+	if [ $GUAVA != "0" ]; then
+		echo "=============================================================================="
+		echo "Detected $GUAVA guava dependencies in fat jar"
+		echo "=============================================================================="
+		exit 1
+	fi
+
+}
+
 # =============================================================================
 # WATCHDOG
 # =============================================================================
@@ -189,6 +210,8 @@ echo "MVN exited with EXIT CODE: ${EXIT_CODE}."
 rm $MVN_PID
 rm $MVN_EXIT
 
+check_shaded_artifacts
+
 put_yarn_logs_to_artifacts
 
 upload_artifacts_s3


Mime
View raw message