Wrapper

API Documentation:Wrapper

Generates scripts (for *nix and windows) which allow you to build your project with Gradle, without having to install Gradle.

When a user executes a wrapper script the first time, the script downloads and installs the appropriate Gradle distribution and runs the build against this downloaded distribution. Any installed Gradle distribution is ignored when using the wrapper scripts.

The scripts generated by this task are intended to be committed to your version control system. This task also generates a small gradle-wrapper.jar bootstrap JAR file and properties file which should also be committed to your VCS. The scripts delegates to this JAR.

Properties

PropertyDescription
archiveBase

The archive base specifies whether the unpacked wrapper distribution should be stored in the project or in the gradle user home dir.

archivePath

The path where the gradle distributions archive should be saved (i.e. the parent dir). The path is relative to the archive base directory.

distributionBase

The distribution base specifies whether the unpacked wrapper distribution should be stored in the project or in the gradle user home dir.

distributionPath

The path where the gradle distributions needed by the wrapper are unzipped. The path is relative to the distribution base directory

distributionUrl

The URL to download the gradle distribution from.

gradleVersion

The gradle version for the wrapper.

jarFile

The file to write the wrapper jar file to.

propertiesFile

The file to write the wrapper properties to.

scriptFile

The file to write the wrapper script to.

Methods

No methods

Script blocks

No script blocks

Property details

PathBase archiveBase

The archive base specifies whether the unpacked wrapper distribution should be stored in the project or in the gradle user home dir.

Default:
PathBase.GRADLE_USER_HOME

String archivePath

The path where the gradle distributions archive should be saved (i.e. the parent dir). The path is relative to the archive base directory.

Default:
'wrapper/dists'

PathBase distributionBase

The distribution base specifies whether the unpacked wrapper distribution should be stored in the project or in the gradle user home dir.

Default:
PathBase.GRADLE_USER_HOME

String distributionPath

The path where the gradle distributions needed by the wrapper are unzipped. The path is relative to the distribution base directory

Default:
'wrapper/dists'

String distributionUrl

The URL to download the gradle distribution from.

If not set, the download URL is the default for the specified Wrapper.getGradleVersion().

If Wrapper.getGradleVersion() is not set, will return null.

The wrapper downloads a certain distribution only once and caches it. If your distribution base is the project, you might submit the distribution to your version control system. That way no download is necessary at all. This might be in particular interesting, if you provide a custom gradle snapshot to the wrapper, because you don't need to provide a download server then.

Default:
"http\://services.gradle.org/distributions/gradle-${gradleVersion}-bin.zip" (or "http\://services.gradle.org/distributions-snapshots/gradle-${gradleVersion}-bin.zip" for snapshot versions).

String gradleVersion

The gradle version for the wrapper.

Default:
gradle.gradleVersion

File jarFile

The file to write the wrapper jar file to.

Default:
${project.projectDir}/gradle/wrapper/gradle-wrapper.jar

File propertiesFile (read-only)

The file to write the wrapper properties to.

Default:
jarFile, replacing .jar with .properties

File scriptFile

The file to write the wrapper script to.

Default:
${project.projectDir}/gradlew