Skip to content

bzlmod using local repositories #196

Open
@SimonVleugels

Description

Hi,
I'm trying to use bazel-diff with bzlmod enabled using only local_repositories (no connection to bcr). I'm getting unknown repo errors:

ERROR: /repo/bazel-test-repo/BUILD.bazel:9:6: error loading package '@bazel_diff~override//cli': 
Unable to find package for @[unknown repo 'rules_jvm_external' requested from @bazel_diff~override]//:defs.bzl: 
The repository '@[unknown repo 'rules_jvm_external' requested from @bazel_diff~override]' could not be resolved: 
No repository visible as '@rules_jvm_external' from repository '@bazel_diff~override'. and referenced by '//:bazel-diff'

Bazel command:

./bazel-6.3.2 run \
--override_repository=bazel_diff=/repo/bazel-test-repo/build/bazel_diff \
--override_repository=io_bazel_rules_kotlin=/repo/bazel-test-repo/build/io_bazel_rules_kotlin \
--override_repository=rules_jvm_external=/repo/bazel-test-repo/build/rules_jvm_external \
--override_repository=rules_kotlin=/repo/bazel-test-repo/build/rules_kotlin \
--override_repository=rules_proto=/repo/bazel-test-repo/build/rules_proto \
--enable_bzlmod //:bazel-diff

Not sure what I'm doing wrong.

BUILD.bazel

alias(
    name = "bazel-diff",
    actual = "@bazel_diff//cli:bazel-diff",
)

MODULE.bazel

bazel_dep(name = "rules_proto")
local_path_override(
    module_name = "rules_proto",
    path = "/repo/bazel-test-repo/build/rules_proto",
)

bazel_dep(name = "bazel_skylib")
local_path_override(
    module_name = "bazel_skylib",
    path = "/repo/bazel-test-repo/build/bazel_skylib",
)

bazel_dep(name = "io_bazel_rules_kotlin")
local_path_override(
    module_name = "io_bazel_rules_kotlin",
    path = "/repo/bazel-test-repo/build/io_bazel_rules_kotlin",
)

bazel_dep(name = "rules_jvm_external")
local_path_override(
    module_name = "rules_jvm_external",
    path = "/repo/bazel-test-repo/build/rules_jvm_external",
)

bazel_dep(name = "bazel_diff")
local_path_override(
    module_name = "bazel_diff",
    path = "/repo/bazel-test-repo/build/bazel_diff",
)

WORKSPACE

#empty

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions