Package org.gradle.util

## Class GradleVersion

- java.lang.Object
- - org.gradle.util.GradleVersion

- All Implemented Interfaces:
    `Comparable<GradleVersion>`

      public abstract class GradleVersion
      extends Object
      implements Comparable<GradleVersion>

  Represents a Gradle version.

- - ### Field Summary

    Fields
    Modifier and Type | Field | Description
    --- | --- | ---
    `static String` | `RESOURCE_NAME` | Deprecated. will be removed in Gradle 8.
    `static String` | `URL` | Deprecated. will be removed in Gradle 8.
    `static String` | `VERSION_NUMBER_PROPERTY` | Deprecated. will be removed in Gradle 8.
    `static String` | `VERSION_OVERRIDE_VAR` | Deprecated. will be removed in Gradle 8.

  - ### Constructor Summary

    Constructors
    Constructor | Description
    --- | ---
    `GradleVersion()` |

  - ### Method Summary

    All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Deprecated Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `abstract int` | `compareTo​(GradleVersion o)` |
    `static GradleVersion` | `current()` | Returns the current Gradle version.
    `abstract GradleVersion` | `getBaseVersion()` | The base version of this version.
    `abstract String` | `getBuildTime()` | Deprecated. will be removed in Gradle 8.
    `abstract GradleVersion` | `getNextMajor()` | Deprecated. will be removed in Gradle 8.
    `abstract String` | `getRevision()` | Deprecated. will be removed in Gradle 8.
    `abstract String` | `getVersion()` | Returns the string that represents this version.
    `abstract boolean` | `isSnapshot()` | Returns `true` if this instance represent a snapshot version (e.g.
    `abstract boolean` | `isValid()` | Deprecated. will be removed in Gradle 8.
    `static GradleVersion` | `version​(String version)` | Parses the given string into a GradleVersion.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Field Detail

    - #### URL

          @Deprecated
          public static final String URL

      Deprecated.
      will be removed in Gradle 8.
      This field only kept here to maintain binary compatibility.
      See Also:
        Constant Field Values

    - #### RESOURCE_NAME

          @Deprecated
          public static final String RESOURCE_NAME

      Deprecated.
      will be removed in Gradle 8.
      This field only kept here to maintain binary compatibility.
      See Also:
        Constant Field Values

    - #### VERSION_OVERRIDE_VAR

          @Deprecated
          public static final String VERSION_OVERRIDE_VAR

      Deprecated.
      will be removed in Gradle 8.
      This field only kept here to maintain binary compatibility.
      See Also:
        Constant Field Values

    - #### VERSION_NUMBER_PROPERTY

          @Deprecated
          public static final String VERSION_NUMBER_PROPERTY

      Deprecated.
      will be removed in Gradle 8.
      This field only kept here to maintain binary compatibility.
      See Also:
        Constant Field Values

  - ### Constructor Detail

    - #### GradleVersion

          public GradleVersion()

  - ### Method Detail

    - #### current

          public static GradleVersion current()

      Returns the current Gradle version.
      Returns:
        The current Gradle version.

    - #### version

          public static GradleVersion version​(String version)
                                       throws IllegalArgumentException

      Parses the given string into a GradleVersion.
      Throws:
        `IllegalArgumentException` - On unrecognized version string.

    - #### getVersion

          public abstract String getVersion()

      Returns the string that represents this version.
      Returns:
        this Gradle version in string format.

    - #### getBuildTime

          @Deprecated
          public abstract String getBuildTime()

      Deprecated.
      will be removed in Gradle 8.
      This method only kept here to maintain binary compatibility.

    - #### getRevision

          @Deprecated
          public abstract String getRevision()

      Deprecated.
      will be removed in Gradle 8.
      This method only kept here to maintain binary compatibility.

    - #### isSnapshot

          public abstract boolean isSnapshot()

      Returns `true` if this instance represent a snapshot version (e.g. 7.0-20210406233629+0000).
      Returns:
        Whether the current instance is a snapshot version

    - #### getBaseVersion

          public abstract GradleVersion getBaseVersion()

      The base version of this version. For pre-release versions, this is the target version. For example, the version base of '7.0-rc-1' is '7.0'.
      Returns:
        The version base

    - #### getNextMajor

          @Deprecated
          public abstract GradleVersion getNextMajor()

      Deprecated.
      will be removed in Gradle 8.
      This method only kept here to maintain binary compatibility.

    - #### isValid

          @Deprecated
          public abstract boolean isValid()

      Deprecated.
      will be removed in Gradle 8.
      This method only kept here to maintain binary compatibility.

    - #### compareTo

          public abstract int compareTo​(GradleVersion o)

      Specified by:
        `compareTo` in interface `Comparable<GradleVersion>`