You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Our codebase today compiles fine on Java 17. There are no issues. I am trying to switch my codebase to compile on Java 21 instead of Java 17. I've found most of the conversions, but one is lingering that I cannot decipher.
load("@rules_java//java:repositories.bzl", "rules_java_dependencies", "rules_java_toolchains")
rules_java_dependencies()
# Register our toolchains firstregister_toolchains(
"//toolchains:javabase21_macos_x86_64",
"//toolchains:javabase21_macos_aarch64",
"//toolchains:javabase21_linux_x86_64",
"//toolchains:java21_toolchain",
)
rules_java_toolchains()
# laterhttp_archive(
name="jdk21_linux_x86_64",
build_file="//toolchains:jdk_linux.BUILD", # this just extracts the filessha256="51fb4d03a4429c39d397d3a03a779077159317616550e4e71624c9843083e7b9",
strip_prefix="jdk-21.0.4+7",
urls= ["https://github.com/adoptium/temurin21-binaries/releases/download/jdk-21.0.4%2B7/OpenJDK21U-jdk_x64_linux_hotspot_21.0.4_7.tar.gz"],
)
The javabase21_* and java21 are just renames of the toolchains that we defined using Java 17. I verified that the names link up corretctly in other code (omitted here).
When I attempt to compile anything on Java 21, the javac task adds the --system <java11> command-line parameter, where <java11> is the downloaded Zulu JDK 11. This means that compilation fails because it can't find JRE classes that were added in Java 17 (and working fine up until now). Let's ignore macos and just focus on Linux.
How can I "encourage" this to only use a Java 21 toolchain, either the local toolchain (if appropriate) or to download/install a toolchain?
The text was updated successfully, but these errors were encountered:
@hvadehra - I will be happy to try. Do you have any quick tips on the best way to debug and troubleshoot this? Are there any specific diagnostic commands, debug dumps, or flags I can use to investigate? I'm happy to examine the output if it might be enlightening. Reconstructing our project to the point of failure will be extremely difficult due to the amount of Bazel code in the project.
You can try blaze build --nobuild --toolchain_resolution_debug=.* //foo:bar and see which toolchain gets selected and why the one you were expecting don't.
hvadehra
added
P2
We'll consider to work on this in future. (Assignee optional)
and removed
P1
I'll work on this now. (Assignee required)
labels
Oct 19, 2024
Setup:
rules_java
7.3.2Bazel 6.5.0
Our codebase today compiles fine on Java 17. There are no issues. I am trying to switch my codebase to compile on Java 21 instead of Java 17. I've found most of the conversions, but one is lingering that I cannot decipher.
WORKSPACE
:The
javabase21_*
andjava21
are just renames of the toolchains that we defined using Java 17. I verified that the names link up corretctly in other code (omitted here).When I attempt to compile anything on Java 21, the javac task adds the
--system <java11>
command-line parameter, where<java11>
is the downloaded Zulu JDK 11. This means that compilation fails because it can't find JRE classes that were added in Java 17 (and working fine up until now). Let's ignore macos and just focus on Linux.How can I "encourage" this to only use a Java 21 toolchain, either the local toolchain (if appropriate) or to download/install a toolchain?
The text was updated successfully, but these errors were encountered: