Skip to content

2.5

Compare
Choose a tag to compare
@jin jin released this 19 Jul 14:28
· 553 commits to master since this release
4b00700

Changelog

  • maven_install.json now includes a field containing the checksum of the pinned dependency tree. The purpose is to prevent accidental modification of maven_install.json directly. To generate this checksum, run bazel run @unpinned_maven//:pin for a new maven_install.json.
  • Added the ability to override generated target labels using the override_targets attribute. Read the documentation for more information.
  • Extended generate_compat_repositories to also generate @group_artifact//:group_artifact labels, which can also be referenced using @group_artifact.
  • Fixed an issue between artifact pinning and use_unsafe_shared_cache.

Usage

In your WORKSPACE file, add:

load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")

RULES_JVM_EXTERNAL_TAG = "2.5"
RULES_JVM_EXTERNAL_SHA = "249e8129914be6d987ca57754516be35a14ea866c616041ff0cd32ea94d2f3a1"

http_archive(
    name = "rules_jvm_external",
    strip_prefix = "rules_jvm_external-%s" % RULES_JVM_EXTERNAL_TAG,
    sha256 = RULES_JVM_EXTERNAL_SHA,
    url = "https://github.com/bazelbuild/rules_jvm_external/archive/%s.zip" % RULES_JVM_EXTERNAL_TAG,
)

load("@rules_jvm_external//:defs.bzl", "maven_install")

maven_install(
    artifacts = [
        "androidx.test.espresso:espresso-core:3.1.1",
        "junit:junit:4.12",
        "com.google.inject:guice:4.0",
    ],
    repositories = [
        "https://jcenter.bintray.com/",
        "https://maven.google.com",
        "https://repo1.maven.org/maven2",
    ],
)

In your BUILD file, reference the targets directly:

android_library(
    name = "test_library",
    srcs = glob(["**/*.java"]),
    deps = [
        "@maven//:com_google_inject_guice",
    ],
    exports = [
        "@maven//:androidx_test_espresso_espresso_core",
        "@maven//:junit_junit",
    ],
)