Register own InstallationSupplier from plugin


Please, help with the following question.

We have our own software management tool in our organization which downloads and installs software from local nexus repository. It can install JDKs as well. I created a Gradle (settings-level) plugin which registers a custom JavaToolchainResolver. This resolver can find an URL of JDK archive in the local nexus based on version from JavaToolchainRequest and everything works well. JDK is downloaded into ~/.gradle/jdks and can be correctly used in the toolchains.

At the same time at the developer’s machine can already be installed required versions of JDK. Our tool installs them into its own directory and it’s possible to enumerate JDKs installed. I have implemented InstallationSupplier which finds already installed JDKs, it is similar to AsdfInstallationSupplier. But I don’t know how to register my InstallationSupplier from plugin. Is this possible?

Thank you in advance!

InstallationSupplier is an internal class, so even if it is possible (not sure whether it is), it would be using internals and could break with any minor release.

You could use the Gradle properties documented at Toolchains for JVM projects to make the auto-discovery look either at environment variables defining JDK locations or a custom path where to search for JDK installations.

1 Like