Open jeffalder opened 1 month ago
Toolchain configuration and selection is tricky to get right and debug. Could you please create and share a reproducer repository for this?
@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.
Setup:
rules_java
7.3.2 Bazel 6.5.0Our 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?