Gradle now supports auto-downloading the JDKs required by the project via the "toolchain" feature. This is super nice because it eliminates the need for devs to manually download the "right" JDKs for the project, so the gradle build "just works" without any dependence on system configuration.
However, Eclipse is not aware of the JDKs that the toolchain feature discovers / fetches, so to get things working in Eclipse devs still end up needing to download the "right" JDKs and manually add them in the "Installed JREs" section of Eclipse's preferences.
Desired Behavior
Ideally, Buildship would be able to auto-discover the JDK paths that Gradle is using and put those specific JDKs on the classpath of the Eclipse projects, without the need to manually configure those JDKs in Eclipse.
Other Notes
Seemingly, Eclipse does not really support adding an "arbitrary" JDK/JRE path to the classpath of a project (all the options require you to first manually register the JRE/JDK within the "Installed JREs" settings). Perhaps it is actually impossible for Buildship to implement full support for Gradle's toolchains feature unless the underlying Eclipse limitation is addressed first...? Or maybe it is actually possible for Buildship to automatically add new JREs/JDKs into the workspace's "Installed JREs" settings?
Provided you have the foojay-toolchains plugin configured (which allows Gradle to auto-fetch JDKs for vendors other than JvmVendorSpec.ADOPTIUM), this block will result in Gradle auto-downloading the latest version of Zulu's Java 11 JDK and using it for compilation. The goal is for buildship / Eclipse to auto-configure the project to use that same auto-downloaded copy of the JDK.
Context
Gradle now supports auto-downloading the JDKs required by the project via the "toolchain" feature. This is super nice because it eliminates the need for devs to manually download the "right" JDKs for the project, so the gradle build "just works" without any dependence on system configuration.
However, Eclipse is not aware of the JDKs that the toolchain feature discovers / fetches, so to get things working in Eclipse devs still end up needing to download the "right" JDKs and manually add them in the "Installed JREs" section of Eclipse's preferences.
Desired Behavior
Ideally, Buildship would be able to auto-discover the JDK paths that Gradle is using and put those specific JDKs on the classpath of the Eclipse projects, without the need to manually configure those JDKs in Eclipse.
Other Notes
Seemingly, Eclipse does not really support adding an "arbitrary" JDK/JRE path to the classpath of a project (all the options require you to first manually register the JRE/JDK within the "Installed JREs" settings). Perhaps it is actually impossible for Buildship to implement full support for Gradle's toolchains feature unless the underlying Eclipse limitation is addressed first...? Or maybe it is actually possible for Buildship to automatically add new JREs/JDKs into the workspace's "Installed JREs" settings?
Example
Provided you have the
foojay-toolchains
plugin configured (which allows Gradle to auto-fetch JDKs for vendors other thanJvmVendorSpec.ADOPTIUM
), this block will result in Gradle auto-downloading the latest version of Zulu's Java 11 JDK and using it for compilation. The goal is for buildship / Eclipse to auto-configure the project to use that same auto-downloaded copy of the JDK.