最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

Bazel build errors stared happening yesterday - Stack Overflow

programmeradmin3浏览0评论

I am trying to build my project using Bazel, but I'm encountering the following error:

"Computing main repo mapping: ERROR: Error computing the main repository mapping: cannot load '@@com_google_j2cl//build_defs:repository.bzl': no such file"

This issue just started happening yesterday, and the build had worked fine for almost 2 years prior.

Here is the http_archive used to load com_google_j2cl:

http_archive(
    name = "com_google_j2cl",
    strip_prefix = "j2cl-master",
    url = ".zip",
)

I can't determine whether this is a Bazel problem or an issue with the j2cl master.zip file. Perhaps a file that used to be in the .zip file is no longer there.

My .bazelrc file:

build --watchfs
build --spawn_strategy=local
build --strategy=J2cl=worker
build --strategy=Closure=worker
build --strategy=Javac=worker
build --strategy=JavaIjar=local
build --strategy=JavaDeployJar=local
build --strategy=JavaSourceJar=local
build --strategy=Turbine=local
test --test_output=errors

# Enable Java 11
build --java_language_version=11

# Enable Java 11 for J2CL compiler itself
build --tool_java_language_version=11

My WORKSPACE file:

workspace(name = "j2clChart")

load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")

# Load j2cl repository
http_archive(
    name = "com_google_j2cl",
    strip_prefix = "j2cl-master",
    url = ".zip",
)

load("@com_google_j2cl//build_defs:repository.bzl", "load_j2cl_repo_deps")
load_j2cl_repo_deps()

load("@com_google_j2cl//build_defs:workspace.bzl", "setup_j2cl_workspace")
setup_j2cl_workspace()

http_archive(
    name = "com_google_elemental2",
    strip_prefix = "elemental2-master",
    url = ".zip",
)

load("@com_google_elemental2//build_defs:repository.bzl", "load_elemental2_repo_deps")
load_elemental2_repo_deps()

load("@com_google_elemental2//build_defs:workspace.bzl", "setup_elemental2_workspace")
setup_elemental2_workspace()

The build fails at this line in the WORKSPACE file:

load("@com_google_j2cl//build_defs:repository.bzl", "load_j2cl_repo_deps")

Additional Information:

  • I downloaded the zip file, but the repository.bzl file is not present in it.

  • I have searched extensively to determine whether this is a Bazel issue or a j2cl issue but am unsure.

  • I am using Bazel 7.4.0. I have tried versions 7.4.1 and 7.5.0, but the issue persists.

  • I also tried changing the Java version to 17 and 21, but the issue remains.

Any help would be greatly appreciated!

发布评论

评论列表(0)

  1. 暂无评论