flink-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "ASF GitHub Bot (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (FLINK-9222) Add a Gradle Quickstart
Date Tue, 10 Jul 2018 10:04:00 GMT

    [ https://issues.apache.org/jira/browse/FLINK-9222?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16538345#comment-16538345
] 

ASF GitHub Bot commented on FLINK-9222:
---------------------------------------

Github user NicoK commented on a diff in the pull request:

    https://github.com/apache/flink/pull/5900#discussion_r201286036
  
    --- Diff: docs/quickstart/java_api_quickstart.md ---
    @@ -108,16 +118,201 @@ In Eclipse, choose
     box: `-Xmx800m`.
     In IntelliJ IDEA recommended way to change JVM options is from the `Help | Edit Custom
VM Options` menu. See [this article](https://intellij-support.jetbrains.com/hc/en-us/articles/206544869-Configuring-JVM-options-and-platform-properties)
for details. 
     
    -## Build Project
    +### Build Project
     
     If you want to __build/package your project__, go to your project directory and
     run the '`mvn clean package`' command.
     You will __find a JAR file__ that contains your application, plus connectors and libraries
     that you may have added as dependencies to the application: `target/<artifact-id>-<version>.jar`.
     
     __Note:__ If you use a different class than *StreamingJob* as the application's main
class / entry point,
    -we recommend you change the `mainClass` setting in the `pom.xml` file accordingly. That
way, the Flink
    -can run time application from the JAR file without additionally specifying the main class.
    +we recommend you change the `mainClass` setting in the `pom.xml` file accordingly. That
way, Flink
    +can run the application from the JAR file without additionally specifying the main class.
    +
    +## Gradle
    +
    +### Requirements
    +
    +The only requirements are working __Gradle 3.x__ (or higher) and __Java 8.x__ installations.
    +
    +### Create Project
    +
    +Use one of the following commands to __create a project__:
    +
    +<ul class="nav nav-tabs" style="border-bottom: none;">
    +        <li class="active"><a href="#gradle-example" data-toggle="tab"><strong>Gradle
example</strong></a></li>
    +    <li><a href="#gradle-script" data-toggle="tab">Run the <strong>quickstart
script</strong></a></li>
    +</ul>
    +<div class="tab-content">
    +    <div class="tab-pane active" id="gradle-example">
    +
    +        <ul class="nav nav-tabs" style="border-bottom: none;">
    +            <li class="active"><a href="#gradle-build" data-toggle="tab"><tt>build.gradle</tt></a></li>
    +            <li><a href="#gradle-settings" data-toggle="tab"><tt>settings.gradle</tt></a></li>
    +        </ul>
    +        <div class="tab-content">
    +            <div class="tab-pane active" id="gradle-build">
    +                {% highlight gradle %}
    +buildscript {
    +    repositories {
    +        jcenter() // this applies only to the Gradle 'Shadow' plugin
    +    }
    +    dependencies {
    +        classpath 'com.github.jengelman.gradle.plugins:shadow:2.0.3'
    +    }
    +}
    +
    +plugins {
    +    id 'java'
    +    id 'application'
    +    // shadow plugin to produce fat JARs
    +    id 'com.github.johnrengelman.shadow' version '2.0.3'
    +}
    +
    +
    +// artifact properties
    +group = 'org.myorg.quickstart'
    +version = '0.1-SNAPSHOT'
    +mainClassName = 'org.myorg.quickstart.StreamingJob'
    +description = """Flink Quickstart Job"""
    +
    +ext {
    +    javaVersion = '1.8'
    +    flinkVersion = '1.6-SNAPSHOT'
    +    scalaBinaryVersion = '2.11'
    +    slf4jVersion = '1.7.7'
    +    log4jVersion = '1.2.17'
    +}
    +
    +
    +sourceCompatibility = javaVersion
    +targetCompatibility = javaVersion
    +tasks.withType(JavaCompile) {
    +	options.encoding = 'UTF-8'
    +}
    +
    +applicationDefaultJvmArgs = ["-Dlog4j.configuration=log4j.properties"]
    +
    +// declare where to find the dependencies of your project
    +repositories {
    +    mavenCentral()
    +    maven { url "https://repository.apache.org/content/repositories/snapshots/" }
    +}
    +
    +// NOTE: We cannot use "compileOnly" or "shadow" configurations since then we could not
run code
    +// in the IDE or with "gradle run". We also cannot exclude transitive dependencies from
the
    +// shadowJar yet (see https://github.com/johnrengelman/shadow/issues/159).
    --- End diff --
    
    Thanks for this tip, unfortunately, this still leaves us with the inability to exclude
transitive dependencies from the shaded jar, i.e.
    ```
        flinkShadowJar.exclude group: 'org.apache.flink', module: 'force-shading'
        flinkShadowJar.exclude group: 'com.google.code.findbugs', module: 'jsr305'
        flinkShadowJar.exclude group: 'org.slf4j'
        flinkShadowJar.exclude group: 'log4j'
    ```
    
    Therefore, we still need the workaround with our own configuration for dependencies that
go into the shaded jar.


> Add a Gradle Quickstart
> -----------------------
>
>                 Key: FLINK-9222
>                 URL: https://issues.apache.org/jira/browse/FLINK-9222
>             Project: Flink
>          Issue Type: Improvement
>          Components: Project Website, Quickstarts
>            Reporter: Nico Kruber
>            Assignee: Nico Kruber
>            Priority: Critical
>              Labels: pull-request-available
>
> Having a proper project template helps a lot in getting dependencies right. For example,
setting the core dependencies to "provided", the connector / library dependencies to "compile",
etc.
> The Maven quickstarts are in good shape by now, but there is none for Gradle and Gradle
users to get this wrong quite often.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Mime
View raw message