Prototype for aar_import_external (downloading without Maven)
2 files changed
tree: e3c81555b8bfa2bfbfab2d9e1d09a8b53d65a2fb
  1. examples/
  2. AUTHORS
  3. BUILD
  4. CONTRIBUTING.md
  5. defs.bzl
  6. gmaven.bzl
  7. GMavenToBazel.java
  8. import_external.bzl
  9. LICENSE
  10. maven_rules.bzl
  11. README.md
  12. settings.xml
  13. WORKSPACE
README.md

gmaven_rules

This project generates gmaven.bzl, a file containing maven_jar and maven_aar rules for all artifacts in https://maven.google.com.

Support Policy

This project is an interim solution that is supported until Google Maven and AAR support is added to bazel-deps.

Usage instructions

To use this from your project, in your WORKSPACE file add

git_repository(
    name = 'gmaven_rules',
    remote = 'https://github.com/aj-michael/gmaven_rules',
    commit = '<FILL IN A COMMIT HERE>',
)
load('@gmaven_rules//:gmaven.bzl', 'gmaven_rules')
gmaven_rules()

You can then reference the generated library targets from your BUILD files like:

load("@gmaven_rules//:defs.bzl", "gmaven_artifact")
android_library(
    ...
    deps = [
        gmaven_artifact("com.android.support:design:aar:27.0.2"),
        gmaven_artifact("com.android.support:support_annotations:jar:27.0.2"),
        gmaven_artifact("com.android.support.test.espresso:espresso_core:aar:3.0.1"),
    ],
)

You can see the full list of generated targets in gmaven.bzl.

Updating gmaven.bzl

To update gmaven.bzl, run the following command. It will take about 5 minutes.

rm gmaven.bzl && javac GMavenToBazel.java && java GMavenToBazel

Known issues

Currently, cross-repository dependency resolution is not supported. Some of the artifacts depend on other artifacts that are not present on Google Maven, and these missing dependencies are silently ignored and may cause failures at runtime.