Skip to content

Commit 09b5078

Browse files
authored
Add protobuf_maven artifacts to protobuf_maven_dev as well so they can still be referenced correctly using the dev namespace for dev-only targets. (#20771)
Otherwise, protobuf_maven_dev may provide a different version from a transitive dep, which can result in the wrong version being selected (e.g. when used for bazel-generated maven artifacts). Also updates protobuf_util_bundle to use protobuf_maven instead of protobuf_maven_dev which is probably more appropriate since its control the deps in the pom.xml file for maven users (though this is functionally the same rn). Fixes #20710 PiperOrigin-RevId: 738887165
1 parent b7f06f1 commit 09b5078

File tree

2 files changed

+15
-13
lines changed

2 files changed

+15
-13
lines changed

MODULE.bazel

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -85,16 +85,18 @@ pip = use_extension("@rules_python//python/extensions:pip.bzl", "pip", dev_depen
8585

8686
use_repo(pip, "protobuf_pip_deps")
8787

88+
PROTOBUF_MAVEN_ARTIFACTS = [
89+
"com.google.code.findbugs:jsr305:3.0.2",
90+
"com.google.code.gson:gson:2.8.9",
91+
"com.google.errorprone:error_prone_annotations:2.5.1",
92+
"com.google.j2objc:j2objc-annotations:2.8",
93+
"com.google.guava:guava:32.0.1-jre",
94+
]
95+
8896
protobuf_maven = use_extension("@rules_jvm_external//:extensions.bzl", "maven")
8997
protobuf_maven.install(
9098
name = "protobuf_maven",
91-
artifacts = [
92-
"com.google.code.findbugs:jsr305:3.0.2",
93-
"com.google.code.gson:gson:2.8.9",
94-
"com.google.errorprone:error_prone_annotations:2.5.1",
95-
"com.google.j2objc:j2objc-annotations:2.8",
96-
"com.google.guava:guava:32.0.1-jre",
97-
],
99+
artifacts = PROTOBUF_MAVEN_ARTIFACTS,
98100
repositories = [
99101
"https://repo1.maven.org/maven2",
100102
"https://repo.maven.apache.org/maven2",
@@ -106,7 +108,7 @@ use_repo(protobuf_maven, "protobuf_maven")
106108
protobuf_maven_dev = use_extension("@rules_jvm_external//:extensions.bzl", "maven", dev_dependency = True)
107109
protobuf_maven_dev.install(
108110
name = "protobuf_maven_dev",
109-
artifacts = [
111+
artifacts = PROTOBUF_MAVEN_ARTIFACTS + [
110112
"com.google.caliper:caliper:1.0-beta-3",
111113
"com.google.guava:guava-testlib:32.0.1-jre",
112114
"com.google.testparameterinjector:test-parameter-injector:1.18",

java/util/BUILD.bazel

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -34,11 +34,11 @@ protobuf_versioned_java_library(
3434
visibility = ["//visibility:public"],
3535
deps = [
3636
"//java/core",
37-
"@protobuf_maven_dev//:com_google_code_findbugs_jsr305",
38-
"@protobuf_maven_dev//:com_google_code_gson_gson",
39-
"@protobuf_maven_dev//:com_google_errorprone_error_prone_annotations",
40-
"@protobuf_maven_dev//:com_google_guava_guava",
41-
"@protobuf_maven_dev//:com_google_j2objc_j2objc_annotations",
37+
"@protobuf_maven//:com_google_code_findbugs_jsr305",
38+
"@protobuf_maven//:com_google_code_gson_gson",
39+
"@protobuf_maven//:com_google_errorprone_error_prone_annotations",
40+
"@protobuf_maven//:com_google_guava_guava",
41+
"@protobuf_maven//:com_google_j2objc_j2objc_annotations",
4242
],
4343
)
4444

0 commit comments

Comments
 (0)