rules_jvm
rules_jvm copied to clipboard
Cannot be used with `--override_repository`: cannot load '@@rules_java//java:repositories.bzl': no such file
We are using rules_jvm
without problems with this in the workspace:
load("@contrib_rules_jvm//:repositories.bzl", "contrib_rules_jvm_deps")
contrib_rules_jvm_deps()
load("@contrib_rules_jvm//:setup.bzl", "contrib_rules_jvm_setup")
contrib_rules_jvm_setup()
However, as soon as we add --override_repository= rules_jvm=/path/to/rules_jvm
the build fails with:
ERROR: Error computing the main repository mapping: at /Users/.../.cache/bazel/.../external/contrib_rules_jvm/setup.bzl:4:6: cannot load '@@rules_java//java:repositories.bzl': no such file
Computing main repo mapping:
Fetching repository @@contrib_rules_jvm_deps; starting
Note, the outer build is running with --noenable_bzlmod
(Bazel 7.0.1) because we have not migrated yet.
The flag should be --override_repository=rules_jvm=/path/to/repository
. If for some reason the build is using bzlmod
(and I see from your comment you don't expect this to be the case), the flag is --override_module
and it should work in the same way.
@shs96c Sorry, that was a typo on my end. We use --noenabled_bzlmod
as given in the comment above. Not sure why it's not loading rules_java
. Maybe it needs a maybe
in contrib_rules_jvm_deps
?