# withGradleVersion

abstract fun withGradleVersion(versionNumber: String): GradleRunner(source)

Configures the runner to execute the build with the version of Gradle specified.

Unless previously downloaded, this method will cause the Gradle runtime for the version specified to be downloaded over the Internet from Gradle's distribution servers. The download will be cached beneath the Gradle User Home directory, the location of which is determined by the following in order of precedence:

1. The system property `"gradle.user.home"`
2. The environment variable `"GRADLE_USER_HOME"`

If neither are present, `"~/.gradle"` will be used, where `"~"` is the value advertised by the JVM's `"user.dir"` system property. The system property and environment variable are read in the process using the runner, not the build process.

Alternatively, you may use withGradleInstallation to use an installation already on the filesystem.

To use a non standard Gradle runtime, or to obtain the runtime from an alternative location, use withGradleDistribution.

#### Return

this

#### Since

2.9

#### Parameters

versionNumber

the version number (e.g. "2.9")

#### See also

withGradleInstallation(File)
withGradleDistribution(URI)