# 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.

Since:
  0.7

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `GradleVersion()`

- ## Method Summary

  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 int`
  `getMajorVersion()`
  Returns the major version of this Gradle version.
  `abstract String`
  `getVersion()`
  Returns the string that represents this version.
  `abstract boolean`
  `isFinal()`
  Returns `true` if this version is a final release.
  `abstract boolean`
  `isSnapshot()`
  Returns `true` if this instance represent a snapshot version (e.g.
  `static GradleVersion`
  `version(String version)`
  Parses the given string into a GradleVersion.

  ### Methods inherited from class Object

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

- ## Constructor Details

  - ### GradleVersion

    public GradleVersion()

- ## Method Details

  - ### current

    public static GradleVersion current()
    Returns the current Gradle version.
    Returns:
      The current Gradle version.
    Since:
      1.0

  - ### version

    public static GradleVersion version(String version) throws IllegalArgumentException
    Parses the given string into a GradleVersion.
    Throws:
      `IllegalArgumentException` - On unrecognized version string.
    Since:
      1.0

  - ### getVersion

    public abstract String getVersion()
    Returns the string that represents this version.
    Returns:
      this Gradle version in string format.
    Since:
      0.7

  - ### 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 is `9`.

    Returns:
      The major version.
    Since:
      9.0.0

  - ### 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
    Since:
      0.9.1

  - ### 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.1-rc-1' is '7.1'.
    Returns:
      The version base
    Since:
      1.8

  - ### isFinal

    @Incubating public abstract boolean isFinal()
    Returns `true` if this version is a final release.
    Returns:
      Whether this version is a final release
    Since:
      9.0.0

  - ### compareTo

    public abstract int compareTo(GradleVersion o)
    Specified by:
      `compareTo` in interface `Comparable<GradleVersion>`