Releases: bazel-contrib/rules_jvm_external
4.4.2
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 = "4.4.2"
RULES_JVM_EXTERNAL_SHA = "735602f50813eb2ea93ca3f5e43b1959bd80b213b836a07a62a29d757670b77b"
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/refs/tags/%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()
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
These are the notable changes for 4.3. For the full list, see this page.
- @shs96c Bzlmod support in #654
- @mauriciogg Enable
pinned_coursier_fetch
to use the Starlark version ofaar_import
in #729 - @shs96c Generate both a BOM and a dependency BOM in #750
The only changes since 4.4 are to support rules_jvm_external
being exposed through the Bazel
Central Repository and accessible via bzlmod
Bug fixes
- @davidmandle Quote java arguments written to arguments file in #721
- @shs96c Use stable zip entries in
MergeJars
in #736 - @shs96c Create empty directories in merged zip files in #737
- @dhalperi
coursier
: prefer the primary_url over mirrors in #743 - @lukaciko Make DOS timestamp local time zone independent in #738
Project health
- @utzcoz Bump Robolectric to 4.8.2 in #733
- @aranguyen Use constraint values from @platforms and migrate to rbe_preconfig in #730
- @mai93 Update bazel_skylib to latest version (1.2.1) in #742
- @shs96c Make rules_jvm_external use strict deps for itself in #741
New Contributors
- @aranguyen made their first contribution in #730
- @davidmandle made their first contribution in #721
- @mai93 made their first contribution in #742
- @lukaciko made their first contribution in #738
4.4.1
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 = "4.4.1"
RULES_JVM_EXTERNAL_SHA = "9781dafe99cf604e1ce43e14598a71fbd6435d995c8069ccda7a3dc094aea333"
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/refs/tags/%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()
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
These are the notable changes for 4.3. For the full list, see this page.
- @shs96c Bzlmod support in #654
- @mauriciogg Enable
pinned_coursier_fetch
to use the Starlark version ofaar_import
in #729 - @shs96c Generate both a BOM and a dependency BOM in #750
Bug fixes
- @davidmandle Quote java arguments written to arguments file in #721
- @shs96c Use stable zip entries in
MergeJars
in #736 - @shs96c Create empty directories in merged zip files in #737
- @dhalperi
coursier
: prefer the primary_url over mirrors in #743 - @lukaciko Make DOS timestamp local time zone independent in #738
Project health
- @utzcoz Bump Robolectric to 4.8.2 in #733
- @aranguyen Use constraint values from @platforms and migrate to rbe_preconfig in #730
- @mai93 Update bazel_skylib to latest version (1.2.1) in #742
- @shs96c Make rules_jvm_external use strict deps for itself in #741
New Contributors
- @aranguyen made their first contribution in #730
- @davidmandle made their first contribution in #721
- @mai93 made their first contribution in #742
- @lukaciko made their first contribution in #738
4.4
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 = "4.4"
RULES_JVM_EXTERNAL_SHA = "0068b92a1527799d7268f6774654ed35024a660c6c68ac1f8011edade905929d"
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/refs/tags/%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()
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
These are the notable changes for 4.3. For the full list, see this page.
- @shs96c Bzlmod support in #654
- @mauriciogg Enable
pinned_coursier_fetch
to use the Starlark version ofaar_import
in #729 - @shs96c Generate both a BOM and a dependency BOM in #750
Bug fixes
- @davidmandle Quote java arguments written to arguments file in #721
- @shs96c Use stable zip entries in
MergeJars
in #736 - @shs96c Create empty directories in merged zip files in #737
- @dhalperi
coursier
: prefer the primary_url over mirrors in #743 - @lukaciko Make DOS timestamp local time zone independent in #738
Project health
- @utzcoz Bump Robolectric to 4.8.2 in #733
- @aranguyen Use constraint values from @platforms and migrate to rbe_preconfig in #730
- @mai93 Update bazel_skylib to latest version (1.2.1) in #742
- @shs96c Make rules_jvm_external use strict deps for itself in #741
New Contributors
- @aranguyen made their first contribution in #730
- @davidmandle made their first contribution in #721
- @mai93 made their first contribution in #742
- @lukaciko made their first contribution in #738
4.3
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 = "4.3"
RULES_JVM_EXTERNAL_SHA = "6274687f6fc5783b589f56a2f1ed60de3ce1f99bc4e8f9edef3de43bdf7c6e74"
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/refs/tags/%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",
],
)
Users upgrading from previous versions are advised to repin their dependencies as the format of the lock file has been updated: bazel run @unpinned_maven//:pin
New features
These are the notable changes for 4.2. For the full list, see this page.
- @shs96c Create a Maven BOM (#731)
- @deannagarcia Add kt_jvm_export rule (#656)
- @smocherla-brex Add support for m2Local repository (#695)
- @hisener Add Amazon S3 support to
java_export
(#696) - @illicitonion Add index of packages in jar files when pinning (#716)
- @beasleyr-vmw Support XDG_CACHE_HOME as used by Coursier (#639)
- @tsawada
java_export
to inherittestonly
on its sub-targets (#674) - @shs96c Use bazel's native json decode method (#659)
- @dmivankov Add new strict_visibility_value= attribute to allow exposing strict dependencies to some scopes (#649)
- @dmivankov Allow setting
:scope
via maven coords too (#646) - @dmivankov Expose list of all artifacts, including transitive (#648)
Bug fixes
- @jin Update from vulnerable 2.x log4j version (#631, #633)
- @hisener Set visibility in all
java_export
targets (#710) - @tsawada java_export: set default
testonly = None
(#675) - @beasleyr-vmw Respect
NO_PROXY=.example.com
(#637) - @dhalperi pin.sh: also sort dependencies by coordinate (#652)
- @NathanHowell Don't fail if an error response is missing during publishing (#699)
- @tjoneslo Fix the Boringssl static dependency loop (#687)
- @dmivankov Propagate bazel tags= in java_export sub-targets (#647)
- @shs96c Allow compile jars to strip illegal automatic module names (#673)
- @shs96c Use buffered IO when writing the output jar (#666)
Project health
- @shs96c Tidy up structure of rules_jvm_external (#628)
- @Wyverald Update rules_kotlin version (#717)
- @utzcoz Add kt_android_local_test demo (#713)
- @utzcoz Upgrade rules_kotlin to 1.6.0 for kotlin_android_app (#715)
- @Bencodes Pass
downloaded_file_path
tohttp_file
by (#702) - @shs96c Merge jar files without unpacking them by @shs96c (#651, #655)
- @Wyverald Upgrade protobuf version to 3.20.0 (#677)
- @dmivankov Don't use jcenter.bintray.com in test, it is sort of EOL (#657)
- @perezd Add explicit jq-linux condition for linux_aarch64 (#661)
New Contributors
- @perezd made their first contribution in #661
- @deannagarcia made their first contribution in #656
- @mauriciogg made their first contribution in #666
- @tsawada made their first contribution in #674
- @Wyverald made their first contribution in #677
- @aiuto made their first contribution in #690
- @cushon made their first contribution in #681
- @tjoneslo made their first contribution in #687
- @NathanHowell made their first contribution in #699
- @hisener made their first contribution in #696
- @smocherla-brex made their first contribution in #695
4.2
Changelog
These are the notable changes for 4.2. For the full list, see this page.
New features
- @cheister extended
RJE_VERBOSE
to output actual command lines invoked during the repo rule function (#577) - @cheister added a warning for when duplicated artifacts are specified (#579, #607, #613)
- @cheister updated coursier to v2.0.16 (#590)
- @Bencodes added support for
srcjar
inaar_import
(#592) - @fmeum made
@maven//:outdated
work with--nolegacy_external_runfiles
(#595) - @danielmachlab added artifact URLs to jvm_import targets for dependency tracking (#609)
- @shs96c added support for javadoc options when generating java docs (#596) and generating java docs optional (#620)
- @shs96c introduced
read_coordinates
in defs.bzl as a helper function (#519) - @shs96c added the ability to use Bazel's native JSON decoder (which is much faster than the Starlark implementation) if the Bazel version supports it (>= 4.0).
Bug fixes
- @cheister fixed quote issues with proxy hosts (#588)
- @cheister fixed command line length limits for Java 9 and above (#589)
- @HackToHell fixed an issue with jq not formatting large JSON files on linux (#597)
- @asinbow fixed an issue with artifact["exclusions"] (#622)
Project health
- @illicitonion fixed an issue with exports in #563
- @philwo removed Ubuntu 16.04 from CI due to EOL (#575)
- @dhalperi made maven_install files always sorted (#611)
Usage
In your WORKSPACE file, add:
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
RULES_JVM_EXTERNAL_TAG = "4.2"
RULES_JVM_EXTERNAL_SHA = "cd1a77b7b02e8e008439ca76fd34f5b07aecb8c752961f9640dea15e9e5ba1ca"
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",
],
)
4.1
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
- @shs96c added
maven_install.fail_if_repin_required
which optionally allows builds to fail if the list of maven dependencies has changed but the lock file has not been regenerated (#509) - @shs96c added a
deploy_env
attribute tojava_export
, which behaves similarly to the one in java_binary (#534) - The
REPIN
environment variable used when repinning deps is also used by other rulesets, such as rules_rust. @gibfahn addedRULES_JVM_EXTERNAL_REPIN
to allow only repinning the java deps (#555)
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 arelease
orlatest
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
'sDefaultInfo
(#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 onrules_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",
],
)
4.0
Project update: we have @cheister joining the project as a co-maintainer! Chris has been a regular contributor to this project since the start, and we're happy to have him onboard. Welcome, Chris!
If you are interested in helping us maintain this project, please contact us on the #maven channel on https://slack.bazel.build.
Changelog
New features
- @cheister updated Coursier to 2.0.7 for #471 (#482)
- @cheister added a
@maven//:outdated
tool to check for updated versions of artifacts for amaven_install
repository. To use it, runbazel run @maven//:outdated
. (#465) - @ablyes added the ability to handle
@
in usernames. (#457) - @gibfahn added the ability to load MavenPublishInfo from
defs.bzl
. (#440) - @gibfahn added a provider to
maven_publish
targets to export the information being published for improved interoperability with other rules (#439) - @divanorama enabled COURSIER_OPTS to be available for the internal coursier invocation (#496)
- @erickj added a
fetch_javadoc
attribute to maven_install to fetch javadoc targets, similar tofetch_sources
for source jars. (#494) (#495) - @dmivankov enabled @unpinned_maven//:pin to be always visible regardless of
strict_visibility
in order to be used in run-based rules likemultirun
. (#492) - @zacharya19 added google cloud storage support to java_export (#463)
- @shs96c introduced an optional
deps
and asetup
macro to allow rules_jvm_external to pull in its own external dependencies, like for Google Cloud Storage support (#481)
Bug fixes
- @shs96c reworked how maven project jars are calculated to correctly include and exclude classes, in the context of situations like Protobuf dependencies and aspects. See the PR for more information. (#475)
- @cheister fixed
Target-Label
manifest stamping with a custom AddJarManifestEntry class, which maintains consistent timestamps of the jar manifest to make local and remote caching work correctly. - @dmivankov fixed an issue with correctly computing leading zeroes in
java_export
checksums (#453) - @alexeagle fixed the path of
jq
in@maven//:pin
to make it runnable (#454) - @dmivankov fixed the spelling of the auth scheme as "Basic" for Artifactory headers (#452)
- @gibfahn fixed a bug with
tags
in the java_export rule (#444) - @shs96c fixed an issue with
--frames
, publishing rules on JDK 13 (#460)
Project health
- @cheister applied a cleanup to use BUILD instead of BUILD.bazel and buildifer these BUILD files (#470)
- @cheister refactored MergeJar to use JarHelper jar entry timestamp logic (#469)
- @jin added a regression test to ensure version intervals keep working. (#446)
Usage
In your WORKSPACE file, add:
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
RULES_JVM_EXTERNAL_TAG = "4.0"
RULES_JVM_EXTERNAL_SHA = "31701ad93dbfe544d597dbe62c9a1fdd76d81d8a9150c2bf1ecf928ecdf97169"
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",
],
)
3.3
Project update: we have @shs96c joining the project as a co-maintainer. Welcome, Simon!
If you are interested in helping us maintain this project, please contact us on the #maven channel on https://slack.bazel.build.
Changelog
- @justhecuke fixed an issue where a jetified Maven artifact did not also jetify the artifact's dependencies #386
- @kevingessner added support for additional netrc lines for downloading pinned artifacts #394
- @kevingessner added support for using
jq
instead of Python to format the pinned maven_install.json, thus removing another system dependency on Python #396 - @wisechengyi added support for a custom Coursier download url via COURSIER_URL env var #402
- @cheister improved artifact pinning's update performance by reusing Coursier's cache #407
- @jin added a verbose mode to debug and surface Coursier's stdout with RJE_VERBOSE #408
- @cheister fixed an issue with the coursier cache path logic for #417 #419
- @shs96c created a suite of rules to upload artifacts to maven repositories. #413
- @shs96c fixed an issue with
jq
breaking artifact pinning #426 - @shs96c extended the MergeJar tool to support configurable duplicate merging algorithms #424
Usage
In your WORKSPACE file, add:
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
RULES_JVM_EXTERNAL_TAG = "3.3"
RULES_JVM_EXTERNAL_SHA = "d85951a92c0908c80bd8551002d66cb23c3434409c814179c0ff026b53544dab"
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",
],
)
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",
],
)
3.1
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 theCOURSIER_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 automaticadd-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",
],
)