Greetings Bazel Dev Team,
Is there a doc to read more about the recent changes to java toolchains? We used to define our own toolchain with --java_toolchain to make use of the Eclipse JDT compiler. I'm trying to get that working in Bazel 5. There seems to be quite a few changes needed and I'm trying to learn what adaptions I have to do.
It seems that --java_toolchain has been replaced with --extra_toolchains. Is my interpretation correct that it's solely depending on the version number, which toolchain is being used? What happens if there are two toolchain definitions for the same Java version? Which one will be selected?
The example here:
https://bazel.build/docs/bazel-and-java#config-java-toolchains
Defines a default_java_toolchain with name = "repository_default_toolchain". The --extra_toolchains argument contains an additional "_definition" suffix. Is this required or a typo?
It looks like this is required. I got passed an error after adding the "_definition" to register_toolchain as well. Maybe this should be documented.
Another question, the java_runtime on default_java_toolchain seems to always point to remote jdks.
java_runtime = "@bazel_tools///tools/jdk:remote_jdk11"
I read in the docs I can force the local JDK with "--extra_toolchains=@local_jdk//:all". That seems to register an additional toolchain for the local JDK, which is then selected by Bazel for compilation. That agains seems confusing as I now have multiple defined and I'm not sure which one would be picked by Bazel for compilation. How would I force the local jdk for compilation with my own default_java_toolchain as defined above?
-Gunnar
--
Gunnar Wagenknecht
gun...@wagenknecht.org,
http://guw.io/