The new toolchains functionality is useful because it centralises the place where the JDK used to compile and run the app can be set. I was surprised to discover that there seems to be no straightforward API to say “just use this JDK in this directory”. There’s lots of auto detection magic, and that can be disabled with a system property, and custom discovery paths for the custom JDK can also be configured, but that’s all done via system properties. What if I want to do it via a plugin or bit of custom build logic? E.g. to fetch my own JDK as part of the build and then point Gradle at it? Such a JDK may not have a custom vendor field but it seems Gradle assumes all JDKs will.
Perhaps I’m overlooking something really obvious, but if there’s a way to say “This directory contains a JDK, use it and don’t ask questions” from build/plugin logic., then I’m not seeing it. Can anyone help?