Package org.gradle.util
Class GradleVersion
java.lang.Object
org.gradle.util.GradleVersion
- All Implemented Interfaces:
Comparable<GradleVersion>
Represents a Gradle version.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionabstract int
static GradleVersion
current()
Returns the current Gradle version.abstract GradleVersion
The base version of this version.abstract int
Returns the major version of this Gradle version.abstract String
Returns the string that represents this version.abstract boolean
isFinal()
Returnstrue
if this version is a final release.abstract boolean
Returnstrue
if this instance represent a snapshot version (e.g.static GradleVersion
Parses the given string into a GradleVersion.
-
Constructor Details
-
GradleVersion
public GradleVersion()
-
-
Method Details
-
current
Returns the current Gradle version.- Returns:
- The current Gradle version.
-
version
Parses the given string into a GradleVersion.- Throws:
IllegalArgumentException
- On unrecognized version string.
-
getVersion
Returns the string that represents this version.- Returns:
- this Gradle version in string format.
-
getMajorVersion
public abstract int getMajorVersion()Returns the major version of this Gradle version.For example, if the version is
"9.3-rc-1"
, the major version is9
.- Returns:
- The major version.
- Since:
- 9.0.0
-
isSnapshot
public abstract boolean isSnapshot()Returnstrue
if this instance represent a snapshot version (e.g. 7.0-20210406233629+0000).- Returns:
- Whether the current instance is a snapshot version
-
getBaseVersion
The base version of this version. For pre-release versions, this is the target version. For example, the version base of '7.1-rc-1' is '7.1'.- Returns:
- The version base
-
isFinal
Returnstrue
if this version is a final release.- Returns:
- Whether this version is a final release
- Since:
- 9.0.0
-
compareTo
- Specified by:
compareTo
in interfaceComparable<GradleVersion>
-