How to prevent bazel from downloading JDK11 and JDK21? #21752
|
We're using JDK8u152 for licensing reasons, but when I follow the Java tutorial (https://bazel.build/start/java) and set JAVA_HOME to point to my installed JDK, when I How do I prevent this? |
Replies: 2 comments 3 replies
|
Yes. Forcing the use of only the local jdk involves two things:
|
Yes.
Forcing the use of only the local jdk involves two things:
The default target
java_runtimeislocal_jdkbut the default executionjava_runtimeisremotejdk_11. To use the local jdk for execution, use--tool_java_runtime_version=local_jdkIf a project does nothing wrt java toolchains in
MODULE.bazel/WORKSPACE, therules_javaorder of registration will be followed where we register the remote jdks before the local one, so those "win" by default. The way to avoid this is to explicitly register the local jdk toolchain first for the project (inMODULE.bazel/WORKSPACE). Alternatively, use--extra_toolchains=@local_jdk//:all