Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why should the Gradle Wrapper be committed to VCS?

From Gradle's documentation:

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.

From: What should NOT be under source control?

I think generated files should not be in the VCS.

When are gradlew and gradle/gradle-wrapper.jar needed?

Why not store a gradle version in the build.gradle file?

like image 360
farmer1992 Avatar asked Dec 03 '13 10:12

farmer1992


People also ask

Why do we need Gradle wrapper?

Gradle is commonly used by developers to manage their project's build lifecycle. It's the default choice of build tool for all new Android projects. In this tutorial, we'll learn about Gradle Wrapper, an accompanying utility that makes it easier to distribute projects.

Should you commit the Gradle directory?

You don't need to keep the . gradle folder. Because once you execute gradle build command again, you can make almost the same . gradle folder again.

Where do you put Gradle wrapper?

The Wrapper shell script and batch file reside in the root directory of a single or multi-project Gradle build. You will need to reference the correct path to those files in case you want to execute the build from a subproject directory e.g. ../../gradlew tasks .

What is the difference between Gradle and Gradle wrapper?

2 Answers. Show activity on this post. The difference lies in the fact that ./gradlew indicates you are using a gradle wrapper. The wrapper is generally part of a project and it facilitates installation of gradle.


1 Answers

Because the whole point of the gradle wrapper is to be able, without having ever installed gradle, and without even knowing how it works, where to download it from, which version, to clone the project from the VCS, to execute the gradlew script it contains, and to build the project without any additional step.

If all you had was a gradle version number in a build.gradle file, you would need a README explaining everyone that gradle version X must be downloaded from URL Y and installed, and you would have to do it every time the version is incremented.

like image 144
JB Nizet Avatar answered Oct 04 '22 15:10

JB Nizet