bazel run @maven//:pin 结果错误:FileNotFoundException

问题描述 投票:0回答:1
➜  simpleproject git:(main) ✗ bazel run @maven//:pin --verbose_failures
ERROR: /private/var/tmp/_bazel_pk/2535445c9817f31453336c07943a57d6/external/rules_jvm_external~/private/extensions/maven.bzl:450:42: Traceback (most recent call last):
        File "/private/var/tmp/_bazel_pk/2535445c9817f31453336c07943a57d6/external/rules_jvm_external~/private/extensions/maven.bzl", line 450, column 42, in maven_impl
                lock_file_content = mctx.read(mctx.path(repo.get("lock_file")))
Error in read: java.io.FileNotFoundException: /Users/pk/personal/simpleproject/maven_install.json (No such file or directory)
ERROR: error evaluating module extension maven in @@rules_jvm_external~//:extensions.bzl
INFO: Elapsed time: 0.130s
INFO: 0 processes.
ERROR: Build did NOT complete successfully
ERROR: Build failed. Not running target
FAILED: 
    Fetching module extension maven in @@rules_jvm_external~//:extensions.bzl; starting

这是我的 MODULE.bazel 文件:

###############################################################################
# Bazel now uses Bzlmod by default to manage external dependencies.
# Please consider migrating your external dependencies from WORKSPACE to MODULE.bazel.
#
# For more details, please check https://github.com/bazelbuild/bazel/issues/18958
###############################################################################

module(name = "my_monorepo")

bazel_dep(name = "gazelle", version = "0.39.1")
bazel_dep(name = "aspect_rules_ts", version = "3.3.1")
bazel_dep(name = "rules_proto", version = "7.0.1")
bazel_dep(name = "rules_proto_grpc", version = "5.0.0")
bazel_dep(name = "rules_jvm_external", version = "6.5")

# Additional configuration for aspect_rules_ts
rules_ts_ext = use_extension("@aspect_rules_ts//ts:extensions.bzl", "ext", dev_dependency = True)

rules_ts_ext.deps(
    ts_version_from = "//frontend:package.json",
)

use_repo(rules_ts_ext, "npm_typescript")

maven = use_extension("@rules_jvm_external//:extensions.bzl", "maven")

maven.install(
    artifacts = [
        "io.grpc:grpc-netty:1.38.0",
        "org.springframework.boot:spring-boot-starter:2.5.2",
        "org.springframework.boot:spring-boot-starter-web:2.5.2",
    ],
    fetch_sources = True,
    lock_file = "//backend:maven_install.json",
)

use_repo(maven, "maven")

我需要预先创建一个 maven_install.json 文件吗?我以为它会为你生成一个。我是不是错过了什么?

我们期望命令执行并生成 maven_install.json 文件。

java bazel bazel-java
1个回答
0
投票

A

maven_install.json
需要手动创建,然后才会使用完整的软件包列表及其版本进行更新,如下所示:

github.com/bazel-contrib/rules_jvm_external/issues/1281

© www.soinside.com 2019 - 2024. All rights reserved.