Skip to content

6.2

Compare
Choose a tag to compare
@shs96c shs96c released this 04 Jul 14:40
· 45 commits to master since this release
61e8eda

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.2")

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.2"
RULES_JVM_EXTERNAL_SHA = "808cb5c30b5f70d12a2a745a29edc46728fd35fa195c1762a596b63ae9cebe05"

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

  • Allow runtime deps to be expressed in generated pom.xml files by @vinnybod in #1113
  • Restore Target Uniqueness Guard in dependency_tree_parser.bzl by @jonshea in #1122
  • Add support for .netrc on Windows by @bartoszpop in #1127
  • Use customized repositories for rules_jvm_external's own dependencies by @honnix in #1133
  • maven_install: fail if 'repositories' attribute is empty by @mattnworb in #1135
  • Mark maven extension as reproducible by @fmeum in #1141
  • Propagate testonly attribute to generated plugins by @rdesgroppes in #1142
  • Pass additional coursier cli options by @honnix in #1137
  • Remove old comment about grpc-java and bzlmod by @benjaminp in #1143
  • Fix bzlmod lockfile always not up-to-date by @BoleynSu in #1171
  • Add RJE_VERBOSE output when a BOM version is overridden by an explicit dependency by @cheister in #1172
  • Keep BOM's dependencies ordered in the same way they are declared by @cheister in #1176
  • Allow maven.artifact to have an empty version so it will get its version from a BOM file by @cheister in #1183
  • Consolidate maven versions of classifiers for an artifact by @cheister in #1179

New Contributors

Full Changelog: 6.1...6.2