In Gradle you can have your project generate a gradle wrapper (gradlew) which you can commit to your repository. All subsequent build(er)s should then just execute:
$ ./gradlew
But how do you generate this? In the new gradle 0.9, the following snipplet generates the wrapper for you:
task wrapper(type: Wrapper) {
gradleVersion = '0.9-preview-1'
}
When you as the build-master now execute gradle wrapper, the buildprocess will generate the following files in the project:
- gradle-wrapper.jar
- gradle-wrapper.properties
- gradlew
- gradlew.bat
Now what does executing the gradlew command do? It first determines whether you have the right version (if any) installed of Gradle. If you do not have that, it downloads it for you. Once that's done, it will build the project using the right version of Gradle, all the time! If the build-master decides that the Gradle version should be bumped, he can edit the task and generate a new wrapper. Each of the people building the project then automatically pick this up.
No comments:
Post a Comment