api / org.gradle.testkit.runner / GradleRunner / withGradleDistribution

withGradleDistribution

abstract fun withGradleDistribution(distribution: URI): GradleRunner

Configures the runner to execute the build using the distribution of Gradle specified.

The given URI must point to a valid Gradle distribution ZIP file. This method is typically used as an alternative to #withGradleVersion(String), where it is preferable to obtain the Gradle runtime from “local” servers.

Unless previously downloaded, this method will cause the Gradle runtime at the given URI to be downloaded. 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.

Parameters

distribution - a URI pointing at a valid Gradle distribution zip file

Return
this

Since
2.9

See Also
#withGradleVersion(String)#withGradleInstallation(File)