➜ 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
This is my MODULE.bazel file:
###############################################################################
# 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")
Do I need to pre-create a maven_install.json file? I assumed it generates one for you. Am I missing something?
We expect the command to go through and generate a maven_install.json file.
A maven_install.json
needs to be created manually and only then will it be updated with the full list of packages and their versions as clarified in the following trouble ticket:
https://github.com/bazel-contrib/rules_jvm_external/issues/1281