[BEAM-4392] Fix :beam-runners-java-fn-execution failure#5457
[BEAM-4392] Fix :beam-runners-java-fn-execution failure#5457lukecwik merged 1 commit intoapache:masterfrom
Conversation
|
This passes with my tests in :beam-runners-java-fn-execution:test with c17332a There is a default rule to include all I have no opinion on which way is right, I'm learning gradle as I go. |
|
Boyuan and I looked through the source code for the shadow plugin and the matching rule was specifically if its explicitly included and not explicitly excluded (with no include rules meaning to include all): So as long as there is one include rule, it disables the default include all rule. |
| @@ -321,7 +321,6 @@ ext.getJavaRelocatedPath = { String suffix -> | |||
|
|
|||
| ext.DEFAULT_SHADOW_CLOSURE = { | |||
There was a problem hiding this comment.
Add a link to the https://github.com/johnrengelman/shadow/blob/98191096a94674245c7b3e63975df9e14f67074e/src/main/groovy/com/github/jengelman/gradle/plugins/shadow/internal/DefaultDependencyFilter.groovy#L123 with an explanation of how include/exclude matching works.
sdks/java/harness/build.gradle
Outdated
| { | ||
| dependencies { | ||
| include('**/*.class') | ||
| //Directly include all depended projects |
sdks/java/harness/build.gradle
Outdated
| include(project(":beam-sdks-java-extensions-google-cloud-platform-core")) | ||
| include(project(":beam-runners-core-java")) | ||
| include(project(":beam-runners-core-construction-java")) | ||
| //Include all dependencies and transitive dependencies |
sdks/java/harness/build.gradle
Outdated
| dependencies { | ||
| include('**/*.class') | ||
| //Directly include all depended projects | ||
| include(project(":beam-model-pipeline")) |
There was a problem hiding this comment.
We want to use the shadow configuration so we'll need to specify these as path: projectName, configuration: "shadow"
We should also use a list containing all the projects and loop over it here and loop over it down below where we add the compile dependencies. This will allow for a person to update the list in one location and have it apply to both the shadow plugin and also the dependency set.
|
It seems like is broken as well with the wrong shadowClosure and should instead exclude all. It is unclear what.* is actually applying to (if anything) and the exclude("io/netty") seems redundant.
|
|
Thanks for getting to the bottom of |
|
Hey Luck @lukecwik , commit a0945b5 addressed exclude all problems. Followings are the shadowJar content: |
|
I suggested some comment fix-ups in boyuanzz#1, feel free to merge into your branch and then this LGTM. |
|
Merged Luke's comments. @lukecwik |
|
With this PR a bunch of dependencies are being included in jars without being relocated. For example, protobuf in sdks-java-core, or protobuf, publicsuffix, and runners-local-java in runners-direct-java. This seems to account for a good number of the remaining problems in my test. |
|
Could you please attach more details about how you notice that |
|
I ran |
|
LGTM! Lets merge this! Looks like the issues I "found" are not caused by this and are present on master. The root cause of my failures was renaming my configuration to |
Root cause:
We have wrong shadowClosure configurations in beam/sdks/java/harness/build.gradle: https://github.com/apache/beam/blob/master/sdks/java/harness/build.gradle#L27, which cause produced jar doesn't include expected dependencies.
Solution:
Change bulid rules of sdks/java/harness to make harness as a uber-jar.
r: @lukecwik @aaltay