Skip to content

3.1

Compare
Choose a tag to compare
@jin jin released this 27 Dec 17:42
· 484 commits to master since this release
9aec21a

Changelog

  • Added Jetifier support.
  • Bumped Coursier to 2.0.0-RC5-3
  • Custom cache locations with use_unsafe_shared_cache can now be configured with the COURSIER_CACHE environment variable.
  • @joprice improved SHA-256 hashing performance in the new Java-based hasher.
  • @gergelyfabian fixed an issue with proxy urls containing ports and slashes.
  • @justhecuke fixed an issue where maven_install was not picking up the contents of the user home ~/.netrc file.
  • @plaird extended the Spring Boot tutorial to build a deployable artifact.
  • @cheister fixed an issue introduced in 3.0 where jar manifest entries were dropped unnecessarily while adding the Target-Label attribute for the automatic add-dep support.
  • Fixed an issue where Coursier would return duplicate artifacts in the dependency tree json, causing use_unsafe_shared_cache to fail on specific artifacts.
  • Fixed crash when downloading artifacts with http in the coordinates.

Usage

In your WORKSPACE file, add:

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

RULES_JVM_EXTERNAL_TAG = "3.1"
RULES_JVM_EXTERNAL_SHA = "e246373de2353f3d34d35814947aa8b7d0dd1a58c2f7a6c41cfeaff3007c2d14"

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 = [
        "junit:junit:4.12",
        "androidx.test.espresso:espresso-core:3.1.1",
        "org.hamcrest:hamcrest-library:1.3",
    ],
    repositories = [
        "https://jcenter.bintray.com/",
        "https://maven.google.com",
        "https://repo1.maven.org/maven2",
    ],
)

In your BUILD file, reference the targets directly:

java_library(
    name = "java_test_deps",
    exports = [
        "@maven//:junit_junit"
        "@maven//:org_hamcrest_hamcrest_library",
    ],
)

android_library(
    name = "android_test_deps",
    exports = [
        "@maven//:junit_junit"
        "@maven//:androidx_test_espresso_espresso_core",
    ],
)