bazelbuild / bazelbuild/bazel

Feature request: Override a use_repo_rule repo from root module

Open
#26,590 3 comments 0 reactions 0 assignees View on GitHub
P2 team-ExternalDeps type: feature request
Dominant language
Java
Stars
25.8k
Forks
4.6k
Avg merge
2d 18h
Merged PRs (30d)
75

Description

### Description of the feature request:

I'm using a bazel module "A", which in turn uses a `use_repo_rule` to create a repo "B". I would like to override "B" from my root module, to use a different source.

It's not a bazel module, so regular `archive_override` doesn't work. It's not an extension so I can't get an extension proxy (afaik?) to pass to `override_repo`.

@fmeum suggested `--override_repository` command line flag as a workaround, and also suggested I file this feature request. (https://bazelbuild.slack.com/archives/CA31HN1T3/p1752807738246299)

### Which category does this issue belong to?

External Dependency

### What underlying problem are you trying to solve with this feature?

_No response_

### Which operating system are you running Bazel on?

_No response_

### What is the output of `bazel info release`?

release 7.6.1

### If `bazel info release` returns `development version` or `(@non-git)`, tell us how you built Bazel.

_No response_

### What's the output of `git remote get-url origin; git rev-parse HEAD` ?

```text

```

### Have you found anything relevant by searching the web?

_No response_

### Any other information, logs, or outputs that you want to share?

_No response_

Contributor guide

Open the contributing guide

Research direction

The issue identifies Bazel module resolution, use_repo_rule, and override_repo as the relevant entry points, but names no source files or tests. Start by tracing how repository rules created with use_repo_rule are represented and how module overrides are handled; done would be a documented and tested way for the root module to replace that repository's source.

Written by the indexing model from the issue text.

Assessment

Domain
build-system
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.