3.2
Changelog
- We've disabled JAR stamping for strict deps suggestions with
buildozer
. This was added in 2.10. We've received multiple reports that the implementation introduces non-determinism and reduces cache hits. If you would like to enable this feature, pass the flag--@rules_jvm_external//settings:stamp_manifest
to your build command. - @artem-zinnatullin added the
jetify_include_list
attribute to maven_install, for jetifying a specific list of artifacts. - @Yannic added support for marking artifacts as
testonly
inmaven_install
. - @gergelyfabian added support for the
COURSIER_OPTS
environment variable to pass options to the JVM running Coursier CLI. - @justhecuke fixed "Argument list too long" errors with the built-in hasher.
- @cheister fixed breakages with artifacts containing "json" in their coordinates.
- @rivashin re-enabled parallel Coursier fetches on Windows.
Usage
In your WORKSPACE file, add:
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
RULES_JVM_EXTERNAL_TAG = "3.2"
RULES_JVM_EXTERNAL_SHA = "82262ff4223c5fda6fb7ff8bd63db8131b51b413d26eb49e3131037e79e324af"
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",
],
)