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
- @kotlaja made their first contribution in #933
- @daewoongoh made their first contribution in #921
- @tirsen made their first contribution in #948
- @agluszak made their first contribution in #984
- @bertschneider made their first contribution in #1002
- @blorente made their first contribution in #996
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 otherjavadoc
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