Open lqc opened 9 months ago
Same problem here in google/or-tools
, we have to stick with v0.9.0
, (and rules_jvm_external==5.2
) to use JUNIT 5...
Currently we are using this in our WORKSPACE
:
# Bazel Extensions
## Bazel Skylib rules.
git_repository(
name = "bazel_skylib",
tag = "1.4.2",
remote = "https://github.com/bazelbuild/bazel-skylib.git",
)
load("@bazel_skylib//:workspace.bzl", "bazel_skylib_workspace")
bazel_skylib_workspace()
...
git_repository(
name = "rules_java",
tag = "6.4.0",
#tag = "6.5.1",
remote = "https://github.com/bazelbuild/rules_java.git",
)
git_repository(
name = "rules_jvm_external",
tag = "5.2",
#tag = "5.3",
remote = "https://github.com/bazelbuild/rules_jvm_external.git",
)
git_repository(
name = "contrib_rules_jvm",
tag = "v0.9.0",
#tag = "v0.19.0",
remote = "https://github.com/bazel-contrib/rules_jvm.git",
)
...
## Java support (with junit 5)
load("@rules_java//java:repositories.bzl", "rules_java_dependencies", "rules_java_toolchains")
rules_java_dependencies()
rules_java_toolchains()
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()
JUNIT_PLATFORM_VERSION = "1.9.2"
JUNIT_JUPITER_VERSION = "5.9.2"
load("@rules_jvm_external//:defs.bzl", "maven_install")
maven_install(
artifacts = [
"net.java.dev.jna:jna:aar:5.13.0",
"com.google.truth:truth:0.32",
"org.junit.platform:junit-platform-launcher:%s" % JUNIT_PLATFORM_VERSION,
"org.junit.platform:junit-platform-reporting:%s" % JUNIT_PLATFORM_VERSION,
"org.junit.jupiter:junit-jupiter-api:%s" % JUNIT_JUPITER_VERSION,
"org.junit.jupiter:junit-jupiter-params:%s" % JUNIT_JUPITER_VERSION,
"org.junit.jupiter:junit-jupiter-engine:%s" % JUNIT_JUPITER_VERSION,
],
repositories = [
"https://repo1.maven.org/maven2",
],
)
load("@contrib_rules_jvm//:repositories.bzl", "contrib_rules_jvm_deps")
contrib_rules_jvm_deps()
load("@contrib_rules_jvm//:setup.bzl", "contrib_rules_jvm_setup")
contrib_rules_jvm_setup()
I have a simple project that uses Bazel 6.3 and bzlmod:
In my
.bazelrc
I'm passing the following options:Note the 'remotejdk_17' for both 'java_runtime_version' and 'tool_java_runtime_version'. The build succeeds locally where I have a JDK installed, but on a CI worker that has not default JDK, it fails with the following errors:
Same error repeats for other JUnit dependencies. AFAIK, this is the internal dependencies of rules_jvm that we are trying to fetch, but somewhere along the line the JDK toolchain is no longer remote.
Is this a bug, or am I doing something wrong? Can I somehow pass the correct toolchain to rules_jvm to use?