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
Hi team, we are planning to upgrade our bazel Java version to 21 in two steps, upgrading runtime first, followed by the toolchain compiler upgrade. I am now stuck at making the configuration work for Java 21 runtime while keeping the toolchain version as 17,
Our current setting with Java 17 in Bazel is, set these flags in .bazelrc
error: [BazelJavaConfiguration] The Java 17 runtime used to run javac is not recent enough to compile for the Java 21 runtime in external/remotejdk21_macos_aarch64. Either register a Java toolchain with a newer java_runtime or specify a lower --tool_java_runtime_version.
...
error: cannot access module-info
bad class file: /modules/java.security.sasl/module-info.class
class file has wrong version 65.0, should be 61.0
Please remove or make sure it appears in the correct subdirectory of the classpath.
Then I go ahead and also change the java_runtime field within default_java_toolchain:
default_java_toolchain(
name = "toolchain_jdk_17",
java_runtime = "@rules_java//toolchains:remotejdk_21",
source_version = "17",
target_version = "17",
# other params
)
That makes the build pass, however I noticed the java compiler was actually 21 as well, while I expected it to stay 17, because I added some code related to VirtualThread and they were compiled successfully.
Did I make any mistakes in my configurations? Appreciate any pointers and tips.
The text was updated successfully, but these errors were encountered:
Hi, thanks for the quick fix! However I am having some trouble applying this change: upgrading to rules_java v8 will break our existing protobuf settings. I tried cherry-picking that change on top of version 7.12.4, but building with the --@rules_java//java:incompatible_language_version_bootclasspath flag didn't change the bootclasspath behavior. Do you know if that change could be backported to version 7?
Hi team, we are planning to upgrade our bazel Java version to 21 in two steps, upgrading runtime first, followed by the toolchain compiler upgrade. I am now stuck at making the configuration work for Java 21 runtime while keeping the toolchain version as 17,
Our current setting with Java 17 in Bazel is, set these flags in .bazelrc
Then register a toolchain with "default_java_toolchain"
My first attempt was to bump these two flags as
However I was seeing some build errors like
Then I go ahead and also change the java_runtime field within default_java_toolchain:
That makes the build pass, however I noticed the java compiler was actually 21 as well, while I expected it to stay 17, because I added some code related to VirtualThread and they were compiled successfully.
Did I make any mistakes in my configurations? Appreciate any pointers and tips.
The text was updated successfully, but these errors were encountered: