Skip to content

Releases: bazelbuild/rules_jvm_external

6.1

26 Apr 05:49
b4321ee
Compare
Choose a tag to compare

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 5.4.1, Bazel 6.5.0, or Bazel 7 or above.

This release requires Java 11 or above to run, both as the host JDK and the build and tool JDK.

Bzlmod

If you are using Bazel 7 or above, in your MODULE.bazel file:

bazel_dep(name = "rules_jvm_external", version = "6.1")

To add dependencies, later in your MODULE.bazel file:

maven = use_extension("@rules_jvm_external//:extensions.bzl", "maven")

maven.install(
    artifacts = [
        "org.seleniumhq.selenium:selenium-java:4.16.1",
    ],
    repositories = [
        "https://repo1.maven.org/maven2",
    ],
    lock_file = "//:maven_install.json",
)

use_repo(
    maven,
    "maven",
)

Workspace-based builds

In your WORKSPACE file, add:

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

RULES_JVM_EXTERNAL_TAG = "6.1"
RULES_JVM_EXTERNAL_SHA = "08ea921df02ffe9924123b0686dc04fd0ff875710bfadb7ad42badb931b0fd50"

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 = [
        "org.seleniumhq.selenium:selenium-java:4.16.1",
    ],
    repositories = [
        "https://repo1.maven.org/maven2",
    ],
    maven_install_json = "//:maven_install.json",
)

Using dependencies

In your BUILD.bazel file, reference the targets directly:

java_library(
    name = "example",
    exports = [
        "@maven//:org_seleniumhq_selenium_selenium_java",
    ],
)

What's Changed

New Contributors

Full Changelog: 6.0...6.1

6.0

18 Jan 12:09
e4bfab1
Compare
Choose a tag to compare
6.0

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 5.4.1, Bazel 6.4.0, or Bazel 7 or above.

Bzlmod

If you are using Bazel 7 or above, in your MODULE.bazel file:

bazel_dep(name = "rules_jvm_external", version = "6.0")

To add dependencies, later in your MODULE.bazel file:

maven = use_extension("@rules_jvm_external//:extensions.bzl", "maven")

maven.install(
    artifacts = [
        "org.seleniumhq.selenium:selenium-java:4.16.1",
    ],
    repositories = [
        "https://repo1.maven.org/maven2",
    ],
    lock_file = "//:maven_install.json",
)

use_repo(
    maven,
    "maven",
)

Workspace-based builds

In your WORKSPACE file, add:

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

RULES_JVM_EXTERNAL_TAG = "6.0"
RULES_JVM_EXTERNAL_SHA = "85fd6bad58ac76cc3a27c8e051e4255ff9ccd8c92ba879670d195622e7c0a9b7"

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 = [
        "org.seleniumhq.selenium:selenium-java:4.16.1",
    ],
    repositories = [
        "https://repo1.maven.org/maven2",
    ],
    maven_install_json = "//:maven_install.json",
)

Using dependencies

In your BUILD.bazel file, reference the targets directly:

java_library(
    name = "example",
    exports = [
        "@maven//:org_seleniumhq_selenium_selenium_java",
    ],
)

New Contributors

What's Changed

  • Requires Java 11 or above
  • Removed support for jetify
  • Improved Bazel 7 and bzlmod support
  • Fix pinning error with Bzlmod by @fmeum in #939
  • Allow passing sensitive credentials for java_export with environment variables by @thirtyseven in #927
  • Add classifier_artifacts parameter to java_export to allow users to publish extra artifacts by @thirtyseven in #926
  • Fix excluded_artifacts for bzlmod by @tirsen in #948
  • Fix testonly attribute handling by @meteorcloudy in #955
  • Add compile-only deps to javadocs classpath by @fmeum in #952
  • javadoc: Allow javadoc targets to reference other javadoc targets by @fmeum in #958
  • java_export: Fix Make variable substitution by @fmeum in #960
  • Only print repin warnings if the repin env vars are missing by @shs96c in #975
  • Normalise timestamps from maven_project_jar with those from java_library by @shs96c in #982
  • Disable JVM perfdata when stamping jars by @cheister in #988
  • Handle conflict markers and empty files for the maven_install lock_file parameter by @shs96c in #991
  • Publish java_export target without sources jar by @bertschneider in #1002
  • feat(maven_install): Customizable repin instructions by @blorente in #1000
  • Allow the "raw" version of overridden targets to be used by @shs96c in #994
  • m2local: solve files not getting resolved by @gergelyfabian in #961
  • Treat empty files in pinning as if they weren't available by @gergelyfabian in #969
  • fix: Publish artifacts without additional classifiers by @bertschneider in #1011
  • Allow the root module to always set the lock file by @shs96c in #1040
  • Update coursier to v2.1.8 by @cheister in #1042

Full Changelog: 5.3...6.0

5.3

23 Jun 14:57
e6c1ff2
Compare
Choose a tag to compare
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

What's Changed

New Contributors

Full Changelog: 5.2...5.3

5.2

13 Apr 14:25
1da66b3
Compare
Choose a tag to compare
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

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

5.1

08 Mar 14:12
3cb8783
Compare
Choose a tag to compare
5.1

Please note The lock file format has changed with this release. 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.1"
RULES_JVM_EXTERNAL_SHA ="8c3b207722e5f97f1c83311582a6c11df99226e65e2471086e296561e57cc954"

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

  • Introduce a new lock file format. This is designed to be more stable as dependencies are updated. Your lock file will be updated when you repin your maven dependencies. For the default dependency, you can do this using REPIN=1 bazel run @unpinned_maven//:pin
  • The outdated command now shows pre-release and regular release information
  • Updated coursier to v2.1.0-RC6
  • The use_unsafe_shared_cache option has been removed from maven_install

New Contributors

What's Changed

  • fix: provide our own remove_prefix implementation by @richardstephens in #790
  • Ensure missing directories are added to zips by @shs96c in #785
  • Add instructions for IPv6 support in rules_jvm_external. by @jin in #791
  • Bump coursier to v2.1.0-RC2 by @jin in #792
  • Add section re: issues with nonstandard JDKs. by @jasonwyatt in #798
  • Document Android SDK dependency for tests by @jonshea in #797
  • Prefer artifacts with dependencies when de-duplicating coursier dependencies by @cheister in #801
  • maven version expanded by @knarukulla in #794
  • fix NO_PROXY handling under Java 9+ by @beasleyr-vmw in #784
  • Avoid failing the build if deploy_env is None by @shs96c in #823
  • Normalize path returned by get_coursier_cache_or_default in _relativize_and_symlink_file_in_coursier_cache by @anthonyjpratti in #825
  • Avoid duplicating items in the dependencies BOM by @shs96c in #832
  • Remove the unsafe_shared_cache option by @shs96c in #834
  • Remove 'sp' from MAVEN_PRE_RELEASE_QUALIFIERS for outdated by @cheister in #840
  • V2 lock file format by @shs96c in #822
  • docs: add documentation for starting with bzlmod by @alexeagle in #838
  • Remove broken README link to Persistent Artifact Cache by @artem-zinnatullin in #845
  • Remove --host_force_python from example bazelrc by @rickeylev in #847
  • Add missing parenthesis on bzlmod docs by @z8v in #848
  • Fix dependencies BOM so it does not include a circular dep by @shs96c in #856
  • Set http.proxyProtocol and https.proxyProtocol for coursier by @cheister in #863
  • transitive dependencies should be visible to their compat alias by @caseyduquettesc in #859
  • list_packages should not fail when the jar is invalid by @cheister in #867
  • Update coursier to v2.1.0-RC6 by @cheister in #868
  • Updated the MODULE.bazel ready for release to the BCR.

Full Changelog: 4.5...5.1

5.0

07 Mar 18:02
2e92f50
Compare
Choose a tag to compare
5.0

Please note The lock file format has changed with this release. 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.0"
RULES_JVM_EXTERNAL_SHA ="8c3cd0ce6aa3dd8c01a414385e0a3807c7a14c769ca0aa3c53fb135c91f9198c"

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/5.0/rules_jvm_external-%s.tar.gz" % 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

  • Introduce a new lock file format. This is designed to be more stable as dependencies are updated. Your lock file will be updated when you repin your maven dependencies. For the default dependency, you can do this using REPIN=1 bazel run @unpinned_maven//:pin
  • The outdated command now shows pre-release and regular release information
  • Updated coursier to v2.1.0-RC6
  • The use_unsafe_shared_cache option has been removed from maven_install

What's Changed

New Contributors

What's Changed

  • fix: provide our own remove_prefix implementation by @richardstephens in #790
  • Ensure missing directories are added to zips by @shs96c in #785
  • Add instructions for IPv6 support in rules_jvm_external. by @jin in #791
  • Bump coursier to v2.1.0-RC2 by @jin in #792
  • Add section re: issues with nonstandard JDKs. by @jasonwyatt in #798
  • Document Android SDK dependency for tests by @jonshea in #797
  • Prefer artifacts with dependencies when de-duplicating coursier dependencies by @cheister in #801
  • maven version expanded by @knarukulla in #794
  • fix NO_PROXY handling under Java 9+ by @beasleyr-vmw in #784
  • Avoid failing the build if deploy_env is None by @shs96c in #823
  • Normalize path returned by get_coursier_cache_or_default in _relativize_and_symlink_file_in_coursier_cache by @anthonyjpratti in #825
  • Avoid duplicating items in the dependencies BOM by @shs96c in #832
  • Remove the unsafe_shared_cache option by @shs96c in #834
  • Remove 'sp' from MAVEN_PRE_RELEASE_QUALIFIERS for outdated by @cheister in #840
  • V2 lock file format by @shs96c in #822
  • docs: add documentation for starting with bzlmod by @alexeagle in #838
  • Remove broken README link to Persistent Artifact Cache by @artem-zinnatullin in #845
  • Remove --host_force_python from example bazelrc by @rickeylev in #847
  • Add missing parenthesis on bzlmod docs by @z8v in #848
  • Fix dependencies BOM so it does not include a circular dep by @shs96c in #856
  • Set http.proxyProtocol and https.proxyProtocol for coursier by @cheister in #863
  • transitive dependencies should be visible to their compat alias by @caseyduquettesc in #859
  • list_packages should not fail when the jar is invalid by @cheister in #867
  • Update coursier to v2.1.0-RC6 by @cheister in #868

Full Changelog: 4.5...5.0

4.5

07 Nov 10:29
853c827
Compare
Choose a tag to compare
4.5

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.5"
RULES_JVM_EXTERNAL_SHA ="b17d7388feb9bfa7f2fa09031b32707df529f26c91ab9e5d909eb1676badd9a6"

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

What's Changed

  • @pcj feature: add coursier --credentials from home netrc #778
  • @brujoand Strip username from pinned urls #772
  • @tsawada Add Google Artifact Registry support to java_export by #779
  • @lukaciko Enable manifest stamping by default #771
  • @utzcoz Bump Robolectric to 4.9 for *android_local_test #764
  • @shs96c Bug fixes in bzlmod support #760 , #773
  • @fmeum Performance improvements #765, #769
  • @fmeum Add deploy_env to java_exports's javadoc class path #768
  • @fmeum Filter java_export source jar based on deploy_env by #767
  • @shs96c Generate a stub so bzl_library works as expected #761
  • @fmeum Do not include Target-Label in java_export manifests #766
  • @fmeum Ensure native rules find maven_project_jar in runfiles #775
  • @fmeum Mention that java_binary isn't supported in java_export deploy_env #776

New Contributors

Full Changelog: 4.4.2...4.5

4.4.2

22 Sep 13:06
be8d3a0
Compare
Choose a tag to compare

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.

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

Project health

New Contributors

4.4.1

21 Sep 17:19
450de09
Compare
Choose a tag to compare

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.

Bug fixes

Project health

New Contributors

4.4

21 Sep 11:16
ce39a6c
Compare
Choose a tag to compare
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.

Bug fixes

Project health

New Contributors