Skip to content

5.1

Compare
Choose a tag to compare
@shs96c shs96c released this 08 Mar 14:12
· 205 commits to master since this release
3cb8783

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