使用 gradlew 和 gradle 的区别 [英] Difference between using gradlew and gradle

查看:55
本文介绍了使用 gradlew 和 gradle 的区别的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用 gradlewgradle 有什么区别或者它们是一样的?

What is the difference between using gradlew and gradle or are they the same?

推荐答案

不同之处在于 ./gradlew 指示您正在使用 gradle 包装器.包装器通常是项目的一部分,它有助于安装 gradle.如果您使用没有包装器的 gradle,则必须手动安装它 - 例如,在 mac brew install gradle 上,然后使用 gradle 命令调用 gradle.在这两种情况下,您都使用 gradle,但前者更方便,并且可以确保不同机器之间的版本一致性.

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. If you were using gradle without the wrapper you would have to manually install it - for example, on a mac brew install gradle and then invoke gradle using the gradle command. In both cases you are using gradle, but the former is more convenient and ensures version consistency across different machines.

每个 Wrapper 都绑定到特定版本的 Gradle,所以当你首先为给定的 Gradle 版本运行上述命令之一,它将下载相应的 Gradle 发行版并将其用于执行构建.

Each Wrapper is tied to a specific version of Gradle, so when you first run one of the commands above for a given Gradle version, it will download the corresponding Gradle distribution and use it to execute the build.

这不仅意味着您不必手动安装 Gradle你自己,但你也一定要使用 Gradle 的版本构建是专为.这使您的历史构建更可靠

Not only does this mean that you don’t have to manually install Gradle yourself, but you are also sure to use the version of Gradle that the build is designed for. This makes your historical builds more reliable

在这里阅读更多 - https://docs.gradle.org/current/userguide/gradle_wrapper.html

此外,Udacity 有一个简洁的高级视频,解释了 gradle 包装器的概念 - https://www.youtube.com/watch?v=1aA949H-shk

Also, Udacity has a neat, high level video explaining the concept of the gradle wrapper - https://www.youtube.com/watch?v=1aA949H-shk

这篇关于使用 gradlew 和 gradle 的区别的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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