From 51262c89c7fad933ac267d606f7c85f46249d7f3 Mon Sep 17 00:00:00 2001 From: Stephan Ewen Date: Fri, 23 Feb 2018 10:53:22 +0100 Subject: [PATCH] [FLINK-8764] [quickstarts] Make quickstarts work out of the box for IDE and JAR packaging - All Flink and Scala dependencies are properly set to provided - That way, Maven JAR packaging behaves correctly by default - Eclipse adds 'provided' dependencies to the classpath when running programs, so works out of the box - There is a profile that automatically activates in IntelliJ that adds the necessary dependencies in 'compile' scope to make it run out of the box. --- .../resources/archetype-resources/pom.xml | 230 +++++++--------- .../resources/archetype-resources/pom.xml | 246 ++++++++---------- 2 files changed, 206 insertions(+), 270 deletions(-) diff --git a/flink-quickstart/flink-quickstart-java/src/main/resources/archetype-resources/pom.xml b/flink-quickstart/flink-quickstart-java/src/main/resources/archetype-resources/pom.xml index b78bf691736d4..6ac05b0419b63 100644 --- a/flink-quickstart/flink-quickstart-java/src/main/resources/archetype-resources/pom.xml +++ b/flink-quickstart/flink-quickstart-java/src/main/resources/archetype-resources/pom.xml @@ -50,162 +50,53 @@ under the License. - - - - org.apache.flink - flink-core - ${flink.version} - + org.apache.flink flink-java ${flink.version} + provided - org.apache.flink - flink-clients_${scala.binary.version} + flink-streaming-java_${scala.binary.version} ${flink.version} + provided + + + + - + + org.slf4j slf4j-log4j12 ${slf4j.version} + runtime log4j log4j ${log4j.version} + runtime - - - - build-jar - - - false - - - - - org.apache.flink - flink-core - ${flink.version} - provided - - - org.apache.flink - flink-java - ${flink.version} - provided - - - org.apache.flink - flink-clients_${scala.binary.version} - ${flink.version} - provided - - - org.apache.flink - flink-streaming-java_${scala.binary.version} - ${flink.version} - provided - - - org.slf4j - slf4j-log4j12 - ${slf4j.version} - provided - - - log4j - log4j - ${log4j.version} - provided - - - - - - - - org.apache.maven.plugins - maven-shade-plugin - 3.0.0 - - - - package - - shade - - - - - org.apache.flink:force-shading - com.google.code.findbugs:jsr305 - org.slf4j:* - - - - - - *:* - - META-INF/*.SF - META-INF/*.DSA - META-INF/*.RSA - - - - - - ${package}.StreamingJob - - - - - - - - - - - + org.apache.maven.plugins maven-compiler-plugin @@ -215,12 +106,57 @@ under the License. 1.8 + + + + + org.apache.maven.plugins + maven-shade-plugin + 3.0.0 + + + + package + + shade + + + + + org.apache.flink:force-shading + com.google.code.findbugs:jsr305 + org.slf4j:* + log4j:* + + + + + + *:* + + META-INF/*.SF + META-INF/*.DSA + META-INF/*.RSA + + + + + + ${package}.StreamingJob + + + + + + - - + + org.eclipse.m2e lifecycle-mapping @@ -247,10 +185,10 @@ under the License. org.apache.maven.plugins - maven-assembly-plugin - [2.4,) + maven-shade-plugin + [3.0.0,) - single + shade @@ -277,6 +215,36 @@ under the License. - --> + + + + + + + add-dependencies-for-IDEA + + + + idea.version + + + + + + org.apache.flink + flink-java + ${flink.version} + compile + + + org.apache.flink + flink-streaming-java_${scala.binary.version} + ${flink.version} + compile + + + + + diff --git a/flink-quickstart/flink-quickstart-scala/src/main/resources/archetype-resources/pom.xml b/flink-quickstart/flink-quickstart-scala/src/main/resources/archetype-resources/pom.xml index 2af71185d68ff..5828d7374c614 100644 --- a/flink-quickstart/flink-quickstart-scala/src/main/resources/archetype-resources/pom.xml +++ b/flink-quickstart/flink-quickstart-scala/src/main/resources/archetype-resources/pom.xml @@ -52,171 +52,104 @@ under the License. 2.11.12 - - - - org.apache.flink - flink-core - ${flink.version} - - - - org.apache.flink - flink-clients_${scala.binary.version} - ${flink.version} - + org.apache.flink flink-scala_${scala.binary.version} ${flink.version} + provided org.apache.flink flink-streaming-scala_${scala.binary.version} ${flink.version} + provided + org.scala-lang scala-library ${scala.version} + provided + + + + + - + + org.slf4j slf4j-log4j12 ${slf4j.version} + runtime log4j log4j ${log4j.version} + runtime - - - - build-jar - - false - - - - org.apache.flink - flink-core - ${flink.version} - provided - - - org.apache.flink - flink-clients_${scala.binary.version} - ${flink.version} - provided - - - org.apache.flink - flink-scala_${scala.binary.version} - ${flink.version} - provided - - - org.apache.flink - flink-streaming-scala_${scala.binary.version} - ${flink.version} - provided - - - org.scala-lang - scala-library - ${scala.version} - provided - - - org.slf4j - slf4j-log4j12 - ${slf4j.version} - provided - - - log4j - log4j - ${log4j.version} - provided - - - - - - - - org.apache.maven.plugins - maven-shade-plugin - 3.0.0 - - - - package - - shade - - - - - org.apache.flink:force-shading - com.google.code.findbugs:jsr305 - org.slf4j:* - - - - - - *:* - - META-INF/*.SF - META-INF/*.DSA - META-INF/*.RSA - - - - - - ${package}.StreamingJob - - - - - - - - - - - + + + + org.apache.maven.plugins + maven-shade-plugin + 3.0.0 + + + + package + + shade + + + + + org.apache.flink:force-shading + com.google.code.findbugs:jsr305 + org.slf4j:* + log4j:* + + + + + + *:* + + META-INF/*.SF + META-INF/*.DSA + META-INF/*.RSA + + + + + + ${package}.StreamingJob + + + + + + + + org.apache.maven.plugins maven-compiler-plugin @@ -226,6 +159,8 @@ under the License. 1.8 + + net.alchim31.maven scala-maven-plugin @@ -240,7 +175,7 @@ under the License. - + org.apache.maven.plugins maven-eclipse-plugin @@ -255,10 +190,8 @@ under the License. org.scala-ide.sdt.core.scalabuilder - org.scala-ide.sdt.launching.SCALA_CONTAINER - - org.eclipse.jdt.launching.JRE_CONTAINER - + org.scala-ide.sdt.launching.SCALA_CONTAINER + org.eclipse.jdt.launching.JRE_CONTAINER org.scala-lang:scala-library @@ -270,8 +203,6 @@ under the License. - - org.codehaus.mojo build-helper-maven-plugin @@ -307,4 +238,41 @@ under the License. + + + + + + + add-dependencies-for-IDEA + + + + idea.version + + + + + + org.apache.flink + flink-scala_${scala.binary.version} + ${flink.version} + compile + + + org.apache.flink + flink-streaming-scala_${scala.binary.version} + ${flink.version} + compile + + + org.scala-lang + scala-library + ${scala.version} + compile + + + + +