为什么Gradle Wrapper要致力于VCS? [英] Why should the Gradle Wrapper be committed to VCS?

查看:135
本文介绍了为什么Gradle Wrapper要致力于VCS?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

https://docs.gradle.org/current/dsl/org.gradle.api.tasks.wrapper.Wrapper.html


此任务生成的脚本旨在将您的版本控制系统提交给
。此任务还会生成一个小
的gradle-wrapper.jar引导程序JAR文件和属性文件,其中
也会被提交到您的VCS。脚本委托给此JAR。


发件人: 什么不应该在源代码控制之下?



我认为生成的文件不应在VCS中。



何时 gradlew gradle / gradle-wrapper.jar 需要?



为什么不存储 gradle version build.gradle 文件中?

解决方案<因为gradle包装器的全部要点是,能够在没有安装gradle的情况下,甚至不知道它是如何工作的,从哪里下载,哪个版本,从VCS复制项目到执行它包含的gradlew脚本,并在没有任何额外步骤的情况下构建项目。



如果您只有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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆