为什么Gradle Wrapper要致力于VCS? [英] Why should the Gradle Wrapper be committed to VCS?
问题描述
此任务生成的脚本旨在将您的版本控制系统提交给
。此任务还会生成一个小
的gradle-wrapper.jar引导程序JAR文件和属性文件,其中
也会被提交到您的VCS。脚本委托给此JAR。
发件人: 什么不应该在源代码控制之下?
我认为生成的文件
不应在VCS中。
何时 gradlew
和 gradle / gradle-wrapper.jar
需要?
为什么不存储 gradle version
在 build.gradle
文件中?
如果您只有build.gradle文件中的gradle版本号,需要一个自述文件解释e非常重要的一点是,必须从URL Y下载并安装Gradle版本X,并且每次增加版本时都必须执行此操作。
From Gradle's documentation: https://docs.gradle.org/current/dsl/org.gradle.api.tasks.wrapper.Wrapper.html
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?
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.
这篇关于为什么Gradle Wrapper要致力于VCS?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!