rules_jvm_external
rules_jvm_external copied to clipboard
@io_bazel_stardoc transitive depencency is not resolved
Following the instruction, I am trying to use examples/spring_boot. (just automatically used Bazel 6.0.0 with Bazelisk, as Bazel 6.0.0 release was today, hence not identified whether caused by new Bazel version)
Basically I took the WORKSPACE file, and adapted it to use rules_jvm_external from respository, as per README.md.
Trying to execute
bazel fetch @maven//...
I run into this error message about repository @io_bazel_stardoc:
C:/users/myuser/_bazel_mlit/5zbjm4tf/external/bazel_tools/tools/build_defs/repo/http.bzl:466:28: in <toplevel>
ERROR: C:/users/myuser/_bazel_mlit/5zbjm4tf/external/maven/BUILD:1373:12: error loading package '@rules_jvm_external//': Unable to find package for @io_bazel_stardoc//stardoc:stardoc.bzl: The repository '@io_bazel_stardoc' could not be resolved: Repository '@io_bazel_stardoc' is not defined. and referenced by '@maven//:defs'
Adding this (should NOT be required), the build is running fine:
# Load transitive dependency for rules_jvm_external, as it's not resolved automatically
http_archive(
name = "io_bazel_stardoc",
sha256 = "3fd8fec4ddec3c670bd810904e2e33170bedfe12f90adf943508184be458c8bb",
urls = [
"https://mirror.bazel.build/github.com/bazelbuild/stardoc/releases/download/0.5.3/stardoc-0.5.3.tar.gz",
"https://github.com/bazelbuild/stardoc/releases/download/0.5.3/stardoc-0.5.3.tar.gz",
],
)
This should be either in your official readme, or better included in your libraries (as transitive version dependency is internal stuff, keeping usage as simple as possible).
This is caused because we export a defs target so that if you're running Stardoc to generate your docs for your own rules that extend ones from rules_jvm_external, you can do that. Normally that target doesn't matter, since in the course of a build it's never referenced, and we've already loaded skylib, which contains the rule we're using.
The problem happens when you try and build it (or fetch, in this case). At that point, you attempt to load the root build file of rules_jvm_external, and this is what requires Stardoc. We use stardoc as a dev-time dependency in order to generate the user docs. We may be able to rejig the way we've structured our build files, because we'd not really expected the kind of usage you're doing.
Leaving this open, since we can probably rejig our build files, but can I ask why you're fetching everything in @maven, and not from your own repo? Doing a bazel fetch ... from your own tree will also cause every transitive dep you use to also be pulled.