我应该 .gitignore 我的 gradlew 吗?
Should I .gitignore my gradlew?
我的 gradle 项目在存储库中包含 gradlew 和 gradlew.bat 文件,是否应该将它们推送到 git?我没有看到有人说他们应该被删除 here。这些文件的用途是什么?
The Wrapper is something you should check into version control. By
distributing the Wrapper with your project, anyone can work with it
without needing to install Gradle beforehand.
不是真的。原因是如果有人下载或克隆您的存储库并尝试通过命令行 运行 您的应用程序并且 he/she 没有在 his/her 本地机器上安装 gradle,he/she 必须安装和配置 Gradle 然后 运行 它。 gradlew 提供了一种方便的方法来 运行 通过安装构建 gradle。
Gradle documentation 是这样说的:
Most tools require installation on your computer before you can use them. If the installation is easy, you may think that’s fine. But it can be an unnecessary burden on the users of the build. Equally importantly, will the user install the right version of the tool for the build? What if they’re building an old version of the software?
The Gradle Wrapper (henceforth referred to as the “Wrapper”) solves both these problems and is the preferred way of starting a Gradle build.
包装器保证您将使用项目所需的 Gradle 版本。您可以轻松地将项目更新到 Gradle 的更新版本,并将这些更改推送到版本控制,以便其他团队成员使用更新版本。
我的 gradle 项目在存储库中包含 gradlew 和 gradlew.bat 文件,是否应该将它们推送到 git?我没有看到有人说他们应该被删除 here。这些文件的用途是什么?
The Wrapper is something you should check into version control. By distributing the Wrapper with your project, anyone can work with it without needing to install Gradle beforehand.
不是真的。原因是如果有人下载或克隆您的存储库并尝试通过命令行 运行 您的应用程序并且 he/she 没有在 his/her 本地机器上安装 gradle,he/she 必须安装和配置 Gradle 然后 运行 它。 gradlew 提供了一种方便的方法来 运行 通过安装构建 gradle。
Gradle documentation 是这样说的:
Most tools require installation on your computer before you can use them. If the installation is easy, you may think that’s fine. But it can be an unnecessary burden on the users of the build. Equally importantly, will the user install the right version of the tool for the build? What if they’re building an old version of the software?
The Gradle Wrapper (henceforth referred to as the “Wrapper”) solves both these problems and is the preferred way of starting a Gradle build.
包装器保证您将使用项目所需的 Gradle 版本。您可以轻松地将项目更新到 Gradle 的更新版本,并将这些更改推送到版本控制,以便其他团队成员使用更新版本。