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

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

Github user NicoK commented on the issue:

    https://github.com/apache/flink/pull/5900
  
    I'm pretty sure I got all this covered by using a separate "configuration": 
`myShadowJar` - not the standard dependency configuration*, but does the trick:
    Everything added to `myShadowJar` inside the `dependencies` gets added to 
the shaded jar (here: shadowJar), except for the explicit excludes which work 
with transitive dependencies as well (defined in the lines starting with 
`myShadowJar.exclude group:` where I included the same things as in the maven 
shade configuration of the quickstart). All user-code dependencies should be 
put into `myShadowJar` - maybe I should make this even more explicit in the 
gradle build file.
    
    - nothing is relocated - there's stuff packed into the jar and other stuff 
that isn't, that's it :) (should be the same - I did compare the jar with the 
one from maven with and without the kafka connector dependency as a test)
    
    - Flink core dependencies are excluded from the uber jar by not putting 
them into `myShadowJar`
    
    - with the trick of using `myShadowJar`, not only is IntelliJ able to run 
the job and the tests, it also runs from commandline
    
    * Unfortunately, I could not use the `shadow`/`compileOnly` dependency 
configurations which are standard for this in gradle because then the program 
would not run in IntelliJ or via `gradle run`. It would expect the environment 
to provide the dependencies which it does not there. Alternatives/fixes for 
this broke the transitive dependency exclusion which is, however, scheduled for 
some future version of the gradle shadow plugin. There a lot of enhancement 
requests in this regard, e.g. https://github.com/johnrengelman/shadow/issues/159


> 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
>
> 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)

Reply via email to