Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you explain what is the difference between "compile" and "shadow"? I thought I understand this but as I read through "Gradle Primier" doc and "BeamModulePlugin.java" file, I start to have doubts. Some questions:
DEFAULT_SHADOW_CLOSURE
that is used there, right? So whichever configuration I use it will still get shadowed the same way. What if Guava wasn't listed in theDEFAULT_SHADOW_CLOSURE
? Would It get shadowed if I use "compile"?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There are two independent parts to what we call "shading": relocating (moving classes into different namespace) and bundling (putting classes into jars). You can do one and not the other. The difference between
compile
andshadow
is bundling. If you have acompile
dependency, then it will be bundled into theshadowJar
. If you have ashadow
dependency, then it will not be bundled into theshadowJar
.The
DEFAULT_SHADOW_CLOSURE
configures relocations and TBH not sure whatinclude(dependency(...))
does. It is not the same as putting it in the scope to be bundled.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Another part which is important for shading between
compile
andshadow
is whether the dependency is listed in thepom.xml
that is uploaded to Maven central for the artifact.compile
: Not part ofpom.xml
shadow
: Part ofpom.xml
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the clarification.