5.3
Please note The lock file format was changed in rules_jvm_external
5.1. If you update and repin your dependencies, your lock file will use the new format.
Usage
This version of rules_jvm_external
requires Bazel 4 or above.
In your WORKSPACE file, add:
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
RULES_JVM_EXTERNAL_TAG = "5.3"
RULES_JVM_EXTERNAL_SHA ="d31e369b854322ca5098ea12c69d7175ded971435e55c18dd9dd5f29cc5249ac"
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/releases/download/%s/rules_jvm_external-%s.tar.gz" % (RULES_JVM_EXTERNAL_TAG, 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()
Then, later in your WORKSPACE
file, you can pull in dependencies from a maven repository:
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",
],
)
New Contributors
- @thirtyseven made their first contribution in #904
- @rdesgroppes made their first contribution in #908
What's Changed
- Bump to Coursier v2.1.2. by @jin in #889
- Bump Robolectric to 4.10 by @utzcoz #891
- Allow semicolons in maven_repo by @thirtyseven in #904
- Allow artifacts from aspects to be excluded by @shs96c in #898
- Use runfiles lookup by @alexeagle in #900
- Add preliminary support for
exe
packaging type by @rdesgroppes in #908 - Fix transitive dep resolution when exclusion is present in other POM by @artem-zinnatullin in #919
New Contributors
Full Changelog: 5.2...5.3