5.2
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.2"
RULES_JVM_EXTERNAL_SHA ="f86fd42a809e1871ca0aabe89db0d440451219c3ce46c58da240c7dcdc00125f"
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 features
bzlmod
users can now use the compat repos should they need to.
New Contributors
- @vorburger made their first contribution in #873
- @sacsar made their first contribution in #858
- @davidkurkov made their first contribution in #883
What's Changed
- Remove hard-coded version in bazel_dep example by @vorburger in #873
- Handle the case where dependencies are empty by @sitaktif in #874
- Expose maven_export by @sacsar in #858
- 'excluded_artifacts' should be formatted in json spec by @yrom in #879
- Allow compat repos to be generated when using
bzlmod
by @shs96c in #880 - Strip auth from url-with-basic-auth when mapping coords by @davidkurkov in #883
- Add kotlin_stdlib to kt_jvm_export deploy_env. by @sacsar in #884
- Skip non-source maven local dependencies in
generate_imports
by @lukaciko in #886
Full Changelog: 5.1...5.2