lukecwik commented on PR #17317: URL: https://github.com/apache/beam/pull/17317#issuecomment-1183917432
> I did some more debugging, and my understanding is that this configuration is effectively removing the `implementation` dep: > > https://github.com/apache/beam/blob/f2e41be4880ef47d86d975c38f353896f70365bd/sdks/java/core/build.gradle#L27-L35 > > because when `shadowClosure` is specified `BeamModulePlugin` removes all of the implementation deps: > > https://github.com/apache/beam/blob/f2e41be4880ef47d86d975c38f353896f70365bd/buildSrc/src/main/groovy/org/apache/beam/gradle/BeamModulePlugin.groovy#L808-L810 > > Hacking up `BeamModulePlugin` to add a hard-coded implementation dep on bytebuddy fixes the build errors I was seeing, which seems to be consistent with that theory: > > ```diff > diff --git a/buildSrc/src/main/groovy/org/apache/beam/gradle/BeamModulePlugin.groovy b/buildSrc/src/main/groovy/org/apache/beam/gradle/BeamModulePlugin.groovy > index 791277a7e1..30b94333e0 100644 > --- a/buildSrc/src/main/groovy/org/apache/beam/gradle/BeamModulePlugin.groovy > +++ b/buildSrc/src/main/groovy/org/apache/beam/gradle/BeamModulePlugin.groovy > @@ -496,6 +496,7 @@ class BeamModulePlugin implements Plugin<Project> { > def testcontainers_version = "1.16.3" > def arrow_version = "5.0.0" > def jmh_version = "1.34" > + def byte_buddy_version = "1.12.9" > > // A map of maps containing common libraries used per language. To use: > // dependencies { > @@ -541,7 +542,7 @@ class BeamModulePlugin implements Plugin<Project> { > aws_java_sdk2_utils : "software.amazon.awssdk:utils:$aws_java_sdk2_version", > bigdataoss_gcsio : "com.google.cloud.bigdataoss:gcsio:$google_cloud_bigdataoss_version", > bigdataoss_util : "com.google.cloud.bigdataoss:util:$google_cloud_bigdataoss_version", > - byte_buddy : "net.bytebuddy:byte-buddy:1.12.9", > + byte_buddy : "net.bytebuddy:byte-buddy:$byte_buddy_version", > cassandra_driver_core : "com.datastax.cassandra:cassandra-driver-core:$cassandra_driver_version", > cassandra_driver_mapping : "com.datastax.cassandra:cassandra-driver-mapping:$cassandra_driver_version", > cdap_api : "io.cdap.cdap:cdap-api:$cdap_version", > @@ -1063,7 +1064,15 @@ class BeamModulePlugin implements Plugin<Project> { > // This contains many improved annotations beyond javax.annotations for enhanced static checking > // of the codebase. It is runtime so users can also take advantage of them. The annotations themselves > // are MIT licensed (checkerframework is GPL and cannot be distributed) > - implementation "org.checkerframework:checker-qual:$checkerframework_version" > + > + def implementationDeps = [ > + "org.checkerframework:checker-qual:$checkerframework_version", > + "net.bytebuddy:byte-buddy:$byte_buddy_version", > + ] > + > + implementationDeps.each { dep -> > + implementation dep > + } > } > > // Defines Targets for sonarqube analysis reporting. > ``` > > What do you recommend? It seems like there are no existing examples of implementation deps that aren't included in the shadow closure. Does it make sense to include it in the shadow closure after all? Is there a more principled change to `BeamModulePlugin` to allow it to be configured to preserve some implementation deps? You should declare byte_buddy within the shadow configuration as per https://github.com/apache/beam/blob/f2e41be4880ef47d86d975c38f353896f70365bd/buildSrc/src/main/groovy/org/apache/beam/gradle/BeamModulePlugin.groovy#L811 This will make it a compile time dependency for the source set and it will be exposed in the pom.xml file and should become a transitive dependency. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
