Skip to content

Bazel Maven Repository Rules v1.0 Release Candidate 3

Pre-release
Pre-release
Compare
Choose a tag to compare
@cgruber cgruber released this 01 Feb 23:01
· 142 commits to master since this release
794daa9

Production Release (candidate 3) of a convenience mechanism to import maven artifacts into a
bazel workspace in a way that is idiomatic to Bazel, but still ends up familiar to people used to
maven repository handling.

This release includes:

  • Single specification of a list of artifacts representing the "universe"
  • Supports multiple repo roots (e.g. alternatives to repo1.maven.org/maven2)
  • Generates a bazel package path per maven group_id, and a target per artifact_id
  • Supports .jar and .aar packaging
  • Very limited support for classifiers (can use the default artifact or a classifier, but not both)
  • Supports SHA256 validation of the artifact (with an insecure option for not specifying them)
  • Tested with java and kotlin rules, including test rules.
  • auto-building of inter-artifact dependencies (from parsed pom metadata)
    • Parent metadata, dependencyManagement, and properties substitution are all supported
  • per-artifact build-snippet substitution (e.g. to wire in annotation processors, or fix mis-specified deps)
  • per-groupId dependency target substitution (to fix internal build cycles created by build snippet substitution)
  • Tested against java, kotlin, and android projects.

Fixes from last RC:

  • Fix for #38 - Critical fix for users using a case-insensitive filesystem who depend (directly or transitively)
    on anything with a groupId containing build. e.g. com.android.tools.build:builder-model:2.3.0, since
    build will become a path element, and the rule will try to read build/ as if it were a BUILD file. Now
    it generates BUILD.bazel files which bazel prefers, so the conflict is avoided.

Known limitations:

  • Doesn't support -SNAPSHOT dependencies (pending v1.1)
  • Only supports single-version per maven_repository_spec() invocation (monorepo-style).
  • Doesn't support multiple maven_repository_spec() calls
  • Doesn't work on Windows by default (requires cat to be installed as a binary tool, which
    could potentially be fixed if bazelbuild/bazel#7309 is accepted

Please see the README.md file for usage instructions and examples of the above features.