Download Gradle User Guide

Transcript
All of these files should be submitted to your version control system. This only needs to be done
once. After these files have been added to the project, the project should then be built with the
added gradlew command. The gradlew command can be used exactly the same way as the
gradle command.
If you want to switch to a new version of Gradle you don't need to rerun the wrapper task. It is good
enough to change the respective entry in the gradle-wrapper.properties file. But if there is
for example an improvement in the gradle-wrapper functionality you need to regenerate the
wrapper files.
54.1. Configuration
If you run Gradle with gradlew, Gradle checks if a Gradle distribution for the wrapper is available.
If not it tries to download it, otherwise it delegates to the gradle command of this distribution with
all the arguments passed originally to the gradlew command.
You can specify where the wrapper files should be stored (within your project directory):
Example 54.3. Configuration of wrapper task
build.gradle
task wrapper(type: Wrapper) {
gradleVersion = '0.9'
jarFile = 'wrapper/wrapper.jar'
}
Build layout
customized/
gradlew
gradlew.bat
wrapper/
wrapper.jar
wrapper.properties
You can specify the download URL of the wrapper distribution. You can also specify where the
wrapper distribution should be stored and unpacked (either within the project or within the Gradle
user home dir). If the wrapper is run and there is local archive of the wrapper distribution Gradle
tries to download it and stores it at the specified place. If there is no unpacked wrapper distribution
Gradle unpacks the local archive of the wrapper distribution at the specified place. All the
configuration options have defaults except the version of the wrapper distribution.
For the details on how to configure the wrapper, see Wrapper
If you don't want any download to happen when your project is build via gradlew, simply add the
Gradle distribution zip to your version control at the location specified by your wrapper
configuration. Relative url is supported - you can specify a distribution file relative to the location of gradle-wr
file.
If you build via the wrapper, any existing Gradle distribution installed on the machine is ignored.
Page 323 of 342