`rules_android_maven` Should Not Force Large Live Coursier Resolution

Open Beginner friendly
#485 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
72/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Quiet
Tech stack
android, java
Domain
build-system

Research direction

Locate the rules_android_maven maven.install definition and inspect the existing rules_android_maven_install.json lock file. Enable the lock file there, then run the reported USE_BAZEL_VERSION=9.0.2 bazelisk build command with RJE_VERBOSE=true and confirm that the build succeeds without the large live Coursier resolution or timeout.

Written by the indexing model from the issue text.

Description

Summary

rules_android@0.7.1 triggers large live Coursier resolution (no lock file), causing slow, fragile builds and frequent timeouts:

Error while fetching artifact with coursier: Timed out

Repro

Repo: https://github.com/bc-lee/rules-android-maven-live-resolution-repro

Run:

RJE_VERBOSE=true USE_BAZEL_VERSION=9.0.2 bazelisk build \
  @rules_android//src/tools/java/com/google/devtools/build/android/r8:r8

(RJE_VERBOSE=true to expose Coursier behavior)

Root Cause

rules_android_maven defines a large maven.install(...) (50+ artifacts) but does not enable its lock file, forcing:

  • large live coursier fetch
  • duplicate resolution (rules_android_maven, bazel_worker_maven)
  • heavy network traffic before actual build

Impact

  • slow builds
  • network-sensitive / flaky (timeouts)
  • problematic in CI or restricted environments

Suggested Fix

Enable the existing lock file:

maven.install(
    name = "rules_android_maven",
    lock_file = "//:rules_android_maven_install.json",
    ...
)

Evidence

With only this change:

-    # lock_file = "//:rules_android_maven_install.json",
+    lock_file = "//:rules_android_maven_install.json",

the same build succeeds reliably.

Workaround

Downstream patch:

+    lock_file = "//:rules_android_maven_install.json",

(Optionally resolver = "gradle")

Dominant language
Java
Stars
203
Forks
95
PR merge metrics
No merged PRs in 30d

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from bazelbuild/rules_android

All issues in bazelbuild/rules_android

Similar issues

More Java issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.