3

According to this and many others places/forums I have looked at, I should always include gradle wrapper files in my git/svn/cvs.

But, why? In my build.gradle file I am already including explicitly the gradle version I want my project working with. Example:

task wrapper(type: Wrapper) {
    gradleVersion = "2.12"
}

I have already made tests and always when I import/build the project without pulling the gradle wrapper files from the source control, it creates the gradlew file for me with the version from build.gradle.

Community
  • 1
  • 1
  • That linked post asks about the properties file itself, not the wrapper binaries. You should exclude the binaries because they are large, and can be downloaded on client machines. You don't exclude the properties file because that says which wrapper to use. – OneCricketeer Dec 05 '16 at 19:29
  • By mentioning gradle wrapper files, I meant both gradle folder (gradle/wrapper/*) and gradlew file. They need to coexist to work properly (I suppose so). – Luiz Felipe Dec 05 '16 at 19:37
  • 1
    This site is useful, by the way. https://www.gitignore.io/ – OneCricketeer Dec 05 '16 at 20:43
  • the wrapper task is just for creating the wrapper files (bash / bat script, wrapper.properties and wrapper jar. In accient gradle versions you had to have that task explicitly written in the build.gradle file. with current gradle versions you just can trigger the wrapper task from the commandline and (optionally) pass the desired gradle version as argument: `gradle wrapper --gradle-version 2.12` – Rene Groeschke Dec 06 '16 at 09:30

1 Answers1

4

Including the wrapper lets people who don't have gradle installed build your project without having to manually download or install anything. This is very helpful for people who are going to build on the command line.

Running ./gradlew installDist is usually easier than having to install gradle in order to bootstrap the correct version.

You'll want to include the following files:

gradlew
gradlew.bat (if you support windows)
gradle
└── wrapper
    ├── gradle-wrapper.jar
    └── gradle-wrapper.properties

and ignore .gradle/

whaleberg
  • 2,093
  • 22
  • 26