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.
Why is this needed? shadowJar is already configured above this for publications
shadowed kotlinpoet/kotlinx-metadata classes are present too
The problem here appears to be that kotlinpoet itself is getting shaded
I tried with your changes and the same issue is still present, not sure if you tried this and saw something different?
The proper fix here is to figure out why this block is excluding kotlinpoet's core artifact from the pom and shading it. This PR just updates the shadow plugin dependency but doesn't fix anything. We probably missed this in the switch to gradle because the kotlin gradle plugin often just uses compiled class files from their local project's build dir directly rather than packaged jars (sometimes annoying quirk of how their incremental compilation works).
One quick fix is to add
exclude(group = "com.squareup", module = "kotlinpoet")
to the shaded kotlinpoet deps to ensure it doesn't shade the core artifact, but still leaves theruntime
issue. This appears to be a long-standing issue in the shadow plugin: GradleUp/shadow#321. We can fix this with awithXml
adjustment. I've opened #1214 to do theseThere 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.
This is needed because it ran too late and the source code was not updated.
So the code still referenced the non shadowed one and failed.
Edit: I meant the non relocated one
Furthermore if you check https://oss.sonatype.org/content/repositories/snapshots/com/squareup/moshi/moshi-kotlin-codegen/1.11.0-SNAPSHOT/ you'll see that recent snapshots does not have the shadow nor the relocated one. (https://oss.sonatype.org/content/repositories/snapshots/com/squareup/moshi/moshi-kotlin-codegen/1.11.0-SNAPSHOT/moshi-kotlin-codegen-1.11.0-20200901.200622-3.jar)