Skip to content

4.1

Compare
Choose a tag to compare
@shs96c shs96c released this 18 May 15:00
· 327 commits to master since this release
786947c

Changelog

After updating to this release, please repin any of your lock files, as the format of this file has changed slightly. This can be done using bazel run @unpinned_maven//:pin. Not repinning isn't an error, but you may see some warnings during the build.

New features

Bug fixes

  • @dhalperi updated bazel run @maven//:outdated, which is used to list artifacts that could be updated, by handling the case where artifact metadata is missing a release or latest tag (#508)
  • @shs96c added code to generate pseudo-compile jars for downloaded dependencies. This should stop warnings about bad path element appearing during compilation (#518)
  • @cheister fixed proxy parsing when the HTTP_PROXY environment variable doesn't have a scheme (#541) (#542)
  • @sitaktif noted that symlinks don't work well when using a Remote Build Environment. They replace symlinks in maven_publish's DefaultInfo (#552)
  • @cheister fixed the stamp_enabled flag so it continues to work as expected (#543)

Project health

  • @shs96c made documentation bzl_library publicly visible. Rules that depend on rules_jvm_external can now be documented with stardoc (#527)
  • @Bencodes updated jetifier to 1.0.0-beta10 (#548)
  • @illicitonion updated the logic for telling users where to place their lock files (#558)

Usage

In your WORKSPACE file, add:

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

RULES_JVM_EXTERNAL_TAG = "4.1"
RULES_JVM_EXTERNAL_SHA = "f36441aa876c4f6427bfb2d1f2d723b48e9d930b62662bf723ddfb8fc80f0140"

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//:repositories.bzl", "rules_jvm_external_deps")

rules_jvm_external_deps()

load("@rules_jvm_external//:setup.bzl", "rules_jvm_external_setup")

rules_jvm_external_setup()

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

maven_install(
    artifacts = [
        "junit:junit:4.13.2",
        "androidx.test.espresso:espresso-core:3.1.1",
        "org.hamcrest:hamcrest-library:2.2",
    ],
    repositories = [
        "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",
    ],
)