I'm using Bazel to build a module that has a dependency on protobuf. Builds were successful until today when they started failing with the following error:
INFO: Repository rules_jvm_external++maven+protobuf_maven instantiated at:
<builtin>: in <toplevel>
Repository rule coursier_fetch defined at:
/builder/home/.cache/bazel/_bazel_ubuntu/eab0d61a99b6696edb3d2aff87b585e8/external/rules_jvm_external+/private/rules/coursier.bzl:1447:33: in <toplevel>
Analyzing: target //server/src/main/java/com/lothaire/expensetracker:expense_tracker_server_push (111 packages loaded, 5149 targets configured)
ERROR: /builder/home/.cache/bazel/_bazel_ubuntu/eab0d61a99b6696edb3d2aff87b585e8/external/rules_jvm_external+/private/rules/coursier.bzl:937:13: An error occurred during the fetch of repository 'rules_jvm_external++maven+protobuf_maven':
Traceback (most recent call last):
File "/builder/home/.cache/bazel/_bazel_ubuntu/eab0d61a99b6696edb3d2aff87b585e8/external/rules_jvm_external+/private/rules/coursier.bzl", line 1051, column 38, in _coursier_fetch_impl
dep_tree = make_coursier_dep_tree(
File "/builder/home/.cache/bazel/_bazel_ubuntu/eab0d61a99b6696edb3d2aff87b585e8/external/rules_jvm_external+/private/rules/coursier.bzl", line 937, 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 @.builder.home..cache.bazel._bazel_ubuntu.eab0d61a99b6696edb3d2aff87b585e8.external.rules_jvm_external++maven+protobuf_maven.java_argsfile
ERROR: /builder/home/.cache/bazel/_bazel_ubuntu/eab0d61a99b6696edb3d2aff87b585e8/external/protobuf+/java/util/BUILD.bazel:8:13: @@protobuf+//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 @.builder.home..cache.bazel._bazel_ubuntu.eab0d61a99b6696edb3d2aff87b585e8.external.rules_jvm_external++maven+protobuf_maven.java_argsfile
I've been trying to make sense of this error. My current interpretation is that no such package '@@rules_jvm_external++maven+protobuf_maven//
means that Bazel is not able to find the Maven dependencies defined here.
I wonder if this is because the flag dev_dependency
is enabled here?
What's puzzling is that this build error only occurs when running the build on Google Cloud Build. Locally, the Build target builds successfully.
Does anyone have a suggestion for solving this? Thank you.