Skip to content

Restore JDK8 compatibility in Bazel for libraries with dependencies f…#20832

Merged
zhangskz merged 1 commit into30.xfrom
cp-jdk8-bazel-util
Mar 26, 2025
Merged

Restore JDK8 compatibility in Bazel for libraries with dependencies f…#20832
zhangskz merged 1 commit into30.xfrom
cp-jdk8-bazel-util

Conversation

@zhangskz
Copy link
Member

…rom Maven (e.g. //java/util)

Adds lock_files to MODULE.bazel for maven dependencies to bypass rules_jvm_external's use of coursier to resolve dependency which is no longer JDK 8 compatible.

ERROR: An error occurred during the fetch of repository 'rules_jvm_external~~maven~protobuf_maven':
   Traceback (most recent call last):
	File "/workspace/_build/out/external/rules_jvm_external~/private/rules/coursier.bzl", line 993, column 38, in _coursier_fetch_impl
		dep_tree = make_coursier_dep_tree(
	File "/workspace/_build/out/external/rules_jvm_external~/private/rules/coursier.bzl", line 926, column 13, in make_coursier_dep_tree
		fail("Error while fetching artifact with coursier: " + exec_result.stderr)
Error in fail: Error while fetching artifact with coursier: Error: Could not find or load main class @.workspace._build.out.external.rules_jvm_external~~maven~protobuf_maven.java_argsfile
ERROR: <builtin>: fetching coursier_fetch rule //:rules_jvm_external~~maven~protobuf_maven: Traceback (most recent call last):
	File "/workspace/_build/out/external/rules_jvm_external~/private/rules/coursier.bzl", line 993, column 38, in _coursier_fetch_impl
		dep_tree = make_coursier_dep_tree(
	File "/workspace/_build/out/external/rules_jvm_external~/private/rules/coursier.bzl", line 926, column 13, in make_coursier_dep_tree
		fail("Error while fetching artifact with coursier: " + exec_result.stderr)
Error in fail: Error while fetching artifact with coursier: Error: Could not find or load main class @.workspace._build.out.external.rules_jvm_external~~maven~protobuf_maven.java_argsfile
ERROR: no such package '@@rules_jvm_external~~maven~protobuf_maven//': Error while fetching artifact with coursier: Error: Could not find or load main class @.workspace._build.out.external.rules_jvm_external~~maven~protobuf_maven.java_argsfile
ERROR: /workspace/java/util/BUILD.bazel:9:13: //java/util:util depends on @@rules_jvm_external~~maven~protobuf_maven//:com_google_j2objc_j2objc_annotations in repository @@rules_jvm_external~~maven~protobuf_maven which failed to fetch. no such package '@@rules_jvm_external~~maven~protobuf_maven//': Error while fetching artifact with coursier: Error: Could not find or load main class @.workspace._build.out.external.rules_jvm_external~~maven~protobuf_maven.java_argsfile
ERROR: Analysis of target '//java/util:util' failed; build aborted: Analysis failed

PiperOrigin-RevId: 739323125

…rom Maven (e.g. //java/util)

Adds lock_files to MODULE.bazel for maven dependencies to bypass rules_jvm_external's use of coursier to resolve dependency which is no longer JDK 8 compatible.

```
ERROR: An error occurred during the fetch of repository 'rules_jvm_external~~maven~protobuf_maven':
   Traceback (most recent call last):
	File "/workspace/_build/out/external/rules_jvm_external~/private/rules/coursier.bzl", line 993, column 38, in _coursier_fetch_impl
		dep_tree = make_coursier_dep_tree(
	File "/workspace/_build/out/external/rules_jvm_external~/private/rules/coursier.bzl", line 926, column 13, in make_coursier_dep_tree
		fail("Error while fetching artifact with coursier: " + exec_result.stderr)
Error in fail: Error while fetching artifact with coursier: Error: Could not find or load main class @.workspace._build.out.external.rules_jvm_external~~maven~protobuf_maven.java_argsfile
ERROR: <builtin>: fetching coursier_fetch rule //:rules_jvm_external~~maven~protobuf_maven: Traceback (most recent call last):
	File "/workspace/_build/out/external/rules_jvm_external~/private/rules/coursier.bzl", line 993, column 38, in _coursier_fetch_impl
		dep_tree = make_coursier_dep_tree(
	File "/workspace/_build/out/external/rules_jvm_external~/private/rules/coursier.bzl", line 926, column 13, in make_coursier_dep_tree
		fail("Error while fetching artifact with coursier: " + exec_result.stderr)
Error in fail: Error while fetching artifact with coursier: Error: Could not find or load main class @.workspace._build.out.external.rules_jvm_external~~maven~protobuf_maven.java_argsfile
ERROR: no such package '@@rules_jvm_external~~maven~protobuf_maven//': Error while fetching artifact with coursier: Error: Could not find or load main class @.workspace._build.out.external.rules_jvm_external~~maven~protobuf_maven.java_argsfile
ERROR: /workspace/java/util/BUILD.bazel:9:13: //java/util:util depends on @@rules_jvm_external~~maven~protobuf_maven//:com_google_j2objc_j2objc_annotations in repository @@rules_jvm_external~~maven~protobuf_maven which failed to fetch. no such package '@@rules_jvm_external~~maven~protobuf_maven//': Error while fetching artifact with coursier: Error: Could not find or load main class @.workspace._build.out.external.rules_jvm_external~~maven~protobuf_maven.java_argsfile
ERROR: Analysis of target '//java/util:util' failed; build aborted: Analysis failed
```
PiperOrigin-RevId: 739323125
@zhangskz zhangskz enabled auto-merge (squash) March 25, 2025 21:54
Copy link
Contributor

@honglooker honglooker left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

backport approved.

@zhangskz zhangskz merged commit da9cadc into 30.x Mar 26, 2025
209 checks passed
@zhangskz zhangskz deleted the cp-jdk8-bazel-util branch March 26, 2025 13:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants