Class JdkResolver
java.lang.Object
com.dua3.gradle.jdkprovider.resolver.JdkResolver
Resolves a JDK installation that matches the specified requirements. The class checks for
compatible local installations or provisions a new JDK using the DiscoAPI when necessary.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected DiscoApiClientprotected JdkProvisionerprotected LocalJdkScannerprotected Pathprotected Optional<JdkInstallation> readJdkSpec(Path jdkHome) Resolves a JDK installation that matches the specified requirements.
-
Constructor Details
-
JdkResolver
public JdkResolver()Constructs a new instance of the JdkResolver.
-
-
Method Details
-
resolve
Resolves a JDK installation that matches the specified requirements. This method checks for compatible local JDK installations and, if none are found, attempts to provision a JDK using the DiscoAPI, provided offline mode is disabled.- Parameters:
jdkQuery- the specification of the JDK version and features required.offlineMode- a flag indicating whether the resolution process should avoid network communication and rely only on local installations.- Returns:
- an
Optionalcontaining aJdkInstallationthat meets the requirements, or an emptyOptionalif no suitable JDK could be resolved. - Throws:
org.gradle.api.GradleException- if the toolchain cannot be resolved due to offline mode or failure in provisioning a JDK using the DiscoAPI.
-
createLocalJdkScanner
-
createDiscoApiClient
-
createJdkProvisioner
-
readJdkSpec
-
provisionPackage
- Throws:
IOExceptionInterruptedException
-