How to define custom JDKs with toolchain block

javaToolchains {
    // Define a toolchain for Java 11
    register("jdk11") {

    // Define a toolchain for Java 17
    register("jdk17") {

this code does not work. as register is not valid…

What do you want to achieve here?
You cannot “register” a toolchain.

I want my build system to have its own jdk irrespective of classpath jdk found or not…

I think that is what the purpose of toolchains as at

I’m not sure why you link a Maven docs page here.
But anyway, you declare what properties of the toolchain you need as documented in the link you posted in your other thread.
You cannot register an own one.

1 Like