Skip to content

rules_android_maven Should Not Force Large Live Coursier Resolution #485

@bc-lee

Description

@bc-lee

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")

Metadata

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