Skip to content

Commit ef0fb79

Browse files
committed
fix: pin protobuf version to prevent grpc transitive upgrade to 3.21.7
grpc-services:1.53.0 transitively pulls protobuf-java:3.21.7 (via grpc-protobuf:1.53.0) which is protobuf v4 with breaking class hierarchy changes. This causes NoSuchMethodError in TimestampProto.getDescriptor() and VerifyError for Duration not assignable to AbstractMessage when running rocketmq-proto:2.1.2 (compiled against protobuf 3.19.4). Add version_conflict_policy = "pinned" to maven_install so the explicitly declared protobuf-java:3.20.1 and protobuf-java-util:3.20.1 versions are used unconditionally instead of being upgraded by transitive resolution.
1 parent c4ca252 commit ef0fb79

1 file changed

Lines changed: 5 additions & 3 deletions

File tree

WORKSPACE

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ rules_jvm_external_setup()
3838
load("@rules_jvm_external//:defs.bzl", "maven_install")
3939

4040
maven_install(
41+
version_conflict_policy = "pinned",
4142
artifacts = [
4243
"junit:junit:4.13.2",
4344
"com.alibaba:fastjson:1.2.83",
@@ -98,6 +99,7 @@ maven_install(
9899
"io.grpc:grpc-context:1.53.0",
99100
"io.grpc:grpc-stub:1.53.0",
100101
"io.grpc:grpc-api:1.53.0",
102+
"io.grpc:grpc-protobuf:1.53.0",
101103
"io.grpc:grpc-testing:1.53.0",
102104
"org.springframework:spring-core:5.3.27",
103105
"io.opentelemetry:opentelemetry-exporter-otlp:1.47.0",
@@ -126,9 +128,9 @@ maven_install(
126128
"com.alibaba.fastjson2:fastjson2:2.0.59",
127129
"org.junit.jupiter:junit-jupiter-api:5.9.1",
128130
],
129-
excluded_artifacts = [
130-
"com.google.protobuf:protobuf-javalite",
131-
],
131+
override_targets = {
132+
"com.google.protobuf:protobuf-javalite": "@maven//:com_google_protobuf_protobuf_java",
133+
},
132134
fetch_sources = False,
133135
repositories = [
134136
"https://repo1.maven.org/maven2",

0 commit comments

Comments
 (0)