public final class GradleDistributionManager extends Object
GradleDistributionManager.GradleDistribution
-s used in the IDE.Modifier and Type | Class and Description |
---|---|
class |
GradleDistributionManager.GradleDistribution
This object represents a Gradle distribution in NetBeans combining the
following four attributes:
Gradle user home
Distribution directory
Gradle version
Gradle distribution URI
|
public static GradleDistributionManager get(File gradleUserHome)
GradleDistributionManager
for the given Gradle user
home.gradleUserHome
- public static GradleDistributionManager get()
GradleDistributionManager
for the Gradle user
home, set in the IDE.public GradleDistributionManager.GradleDistribution distributionFromDir(File distDir) throws IOException
GradleDistributionManager.GradleDistribution
from a manually downloaded and
unpacked directory.distDir
- the directory where Gradle has been installed manuallyIOException
- when the provided directory does not seem to be a
Gradle distribution.public GradleDistributionManager.GradleDistribution distributionFromVersion(String version, boolean withSources)
GradleDistributionManager.GradleDistribution
from a simple version string like
"6.3"
. The returned distribution might be not available but
it can be downloaded and installed with the
GradleDistributionManager.GradleDistribution.install()
method. This method sets the
standard download URI, if the withSources
is set to
false
then the binary only URI would be set.version
- the Gradle versionwithSources
- choose between the 'all' and 'bin' distributionpublic GradleDistributionManager.GradleDistribution distributionFromVersion(String version)
GradleDistributionManager.GradleDistribution
from a simple version string like
"6.3"
. The returned distribution might be not available but
it can be downloaded and installed with the
GradleDistributionManager.GradleDistribution.install()
method. This method sets the
standard download URI for the binary distribution package (no source code
attached).version
- the Gradle versionpublic GradleDistributionManager.GradleDistribution distributionFromWrapper(File gradleProjectRoot) throws IOException, URISyntaxException
GradleDistributionManager.GradleDistribution
from a Gradle root project directory
which contains a Gradle wrapper. The wrapper properties file is expected
to be at gradle/wrapper/gradle-wrapper.properties
.gradleProjectRoot
- the directory of the root Gradle project.IOException
- if the wrapper properties file not found or cannot be
read for some reason.URISyntaxException
- when the distributionUrl
property is missing, has URI syntax problem or the version of
the Gradle distribution cannot be determined form it.public static URI getWrapperDistributionURI(File rootDir) throws IOException, URISyntaxException
rootDir
- the root project directoryIOException
- if there is no gradle-wrapper.properties
or it cannot be read.URISyntaxException
- if the distributionUrl
is missing
or cannot be resolved to a valid URI.public GradleDistributionManager.GradleDistribution defaultDistribution()
GradleDistributionManager.GradleDistribution
from the Gradle version distributed
with the Gradle Tooling of the IDE. This should be the most IDE compatible
version, so it can be used as a fallback.public List<GradleDistributionManager.GradleDistribution> availableDistributions(boolean releaseOnly) throws IOException
GradleDistributionManager.GradleDistribution
s available on the Gradle site and
supported by the IDE. This method uses the
https://services.gradle.org/versions/all
web service to download the list of available versions.releaseOnly
- list only the released versions
(release candidates and milestones included).IOException
- if downloading the list would fail.public List<GradleDistributionManager.GradleDistribution> availableLocalDistributions()
GradleDistributionManager.GradleDistribution
s available on the Gradle Home
of this distribution manager. It looks for the $GRADLE_HOME/wrapper/dists
directory for already downloaded distributions.