NettyChannelBuilder can't locate the name resolver provider from service files when build with minimize shadowJar
ee07b415 opened this issue · 0 comments
Please check the User Guide before submitting "how do I do 'x'?" questions!
Shadow Version
7.1.2
Gradle Version
7.6.4
Expected Behavior
The grpc managed channel can start connection without any problem.
Actual Behavior
After add the minimize () to the shadowJar task, the execution start to saw error like:
io.grpc.NameResolverProvider: io.grpc.netty.UdsNameResolverProvider not a subtype
When I unzip the jar file I can find the io.grpc.NameResolveProvider file and the content:
io.grpc.netty.UdsNameResolverProvider
io.grpc.internal.DnsNameResolverProvider
io.grpc.googleapis.GoogleCloudToProdExperimentalNameResolverProvider
io.grpc.googleapis.GoogleCloudToProdNameResolverProvider
io.grpc.grpclb.SecretGrpclbNameResolverProvider$Provider
io.grpc.netty.shaded.io.grpc.netty.UdsNameResolverProvider
So I think after enable the minimize, the class in jar file can't read from the metadata-INF files for the class it needed, so I'm not sure how to config the minize to include resource file
Gradle Build Script(s)
configurations {
val flinkShadowJar = create("flinkShadowJar")
flinkShadowJar.apply {
extendsFrom(configurations.runtimeClasspath.get())
}
}
tasks.shadowJar {
archiveBaseName.set("flink-job")
archiveVersion.set("1.0-SNAPSHOT")
archiveClassifier.set("")
minimize ()
mergeServiceFiles ()
isZip64 = true
configurations = listOf(project.configurations.getByName("flinkShadowJar"))
}