Gradle has the ability to add a wrapper to projects. This wrapper alleviates the need for all users or continuous integration systems to have Gradle installed. It also prevents version issues where there is some incompatibility between the version the project uses and that which users have installed. It does this by installing a version of gradle locally in the project.
Users of the project simply run:
> ./gradlew <task> # on *Nix or MacOSX
> gradlew <task> # on Windows
To setup a project to use a wrapper, developers:
gradle wrapper [--gradle-version 2.0]
Where --gradle-version X
is optional and if not provided (or the wrapper task isn't included, as shown below), the version used is the version of gradle being used.
build.gradle
:task wrapper(type: Wrapper) {
gradleVersion = '2.0'
}
When the gradle wrapper
command is run it creates the files:
the_project/
gradlew
gradlew.bat
gradle/wrapper/
gradle-wrapper.jar
gradle-wrapper.properties
The official documentation on this feature is at https://docs.gradle.org/current/userguide/gradle_wrapper.html.