Gradle2.0用户指南翻译——第四章. 安装Gradle

简介: 翻译项目请关注Github上的地址:https://github.com/msdx/gradledoc本文翻译所在分支:https://github.com/msdx/gradledoc/tree/2.0 。
翻译项目请关注Github上的地址:
https://github.com/msdx/gradledoc
本文翻译所在分支:
https://github.com/msdx/gradledoc/tree/2.0 。
在线浏览地址:
http://gradledoc.qiniudn.com/2.0/userguide/userguide.html 。
另外,Android 手机用户可通过我写的一个程序浏览文档,带缓存功能的,目前0.6开发中版本兼容 Android 2.3以上系统,项目地址如下:
https://github.com/msdx/gradle-doc-apk
翻译不易,转载请注明本文在CSDN博客上的出处:
http://blog.csdn.net/maosidiaoxian/article/details/77877698

关于我对Gradle的翻译,以Github上的项目及http://gradledoc.qiniudn.com 上的文档为准。如发现翻译有误的地方,将首先在以上两个地方更新。因时间精力问题,博客中发表的译文基本不会同步修改。


第四章. 安装Gradle

Chapter 4. Installing Gradle

4.1. 环境要求

4.1. Prerequisites

Gradle需要安装Java6或更高以上版本的JDK或JRE。Gradle自带了Groovy库,因此不需要安装Groovy。已经安装的Groovy会被Gradle所忽略。 
Gradle requires a Java JDK or JRE to be installed. Gradle requires a Java version 6 or higher. Gradle ships with its own Groovy library, therefore no Groovy needs to be installed. Any existing Groovy installation is ignored by Gradle.

Gradle会使用在您的path环境变量中找到的JDK(可以使用java -version命令来检查自己的JDK版本)。 另外,您也可以设置 JAVA_HOME 环境变量来指向你想要的JDK的安装目录。 
Gradle uses whichever JDK it finds in your path (to check, use java -version). Alternatively, you can set the JAVA_HOME environment variable to point to the install directory of the desired JDK.

4.2. 下载

4.2. Download

您可以从Gradle 官方网站上下载Gradle的发行包。
You can download one of the Gradle distributions from the Gradle web site.

4.3. 解压

4.3. Unpacking

Gradle的发行包是一个ZIP文件。完整的发行包包含以下内容:
The Gradle distribution comes packaged as a ZIP. The full distribution contains:

  • Gradle可执行文件。

    The Gradle binaries.

  • 用户指南(HTML和PDF两种版本)。

    The user guide (HTML and PDF).

  • DSL参考指南。

    The DSL reference guide.

  • API文档(包括Javadoc和Groovydoc)。

    The API documentation (Javadoc and Groovydoc).

  • 大量的样例,包括用户指南里的例子,以及一些完整的和更加复杂的构建。您可以把它们作为您自己的构建的基础。

    Extensive samples, including the examples referenced in the user guide, along with some complete and more complex builds you can use the starting point for your own build.

  • 源代码。这些源代码仅供参考。如果您想要自己来编译Gradle,您需要去下载源码发行包,或者是从源码仓库里检出代码。具体请参阅Gradle官方网站

    The binary sources. This is for reference only. If you want to build Gradle you need to download the source distribution or checkout the sources from the source repository. See the Gradle web site for details.

4.4. 环境变量

4.4. Environment variables

要运行Gradle,您需要将 GRADLE_HOME/bin 添加到您的 PATH环境变量中。通常添加了之后就可以运行Gradle了。 
For running Gradle, add GRADLE_HOME/bin to your PATH environment variable. Usually, this is sufficient to run Gradle.

4.5. 运行和测试您的安装

4.5. Running and testing your installation

您可以通过gradle命令来运行Gradle。输入gradle -v就可以检查Gradle是否被正确安装。该命令会输出Gradle的版本,以及本地环境的配置(groovy和JVM版本等等)。所显示的Gradle版本应该与您已经安装的发行包相匹配。 
You run Gradle via the gradle command. To check if Gradle is properly installed just type gradle -v. The output shows Gradle version and also local environment configuration (groovy and JVM version, etc.). The displayed Gradle version should match the distribution you have downloaded.

4.6. JVM 选项

4.6. JVM options

Gradle运行时的JVM参数可以通过GRADLE_OPTS 或是 JAVA_OPTS的环境变量来设置,这些环境变量也可以一起使用。习惯上, JAVA_OPTS 是一个与其他Java应用程序共享的环境变量,一个典型的场景是在 JAVA_OPTS 中设置HTTP代理,而在GRADLE_OPTS中设置内存选项。这些环境变量也可以在 gradle  gradlew 脚本文件的开头设置。 
JVM options for running Gradle can be set via environment variables. You can use GRADLE_OPTS or JAVA_OPTS. Those variables can be used together. JAVA_OPTS is by convention an environment variable shared by many Java applications. A typical use case would be to set the HTTP proxy inJAVA_OPTS and the memory options in GRADLE_OPTS. Those variables can also be set at the beginning of the gradle or gradlew script.


目录
相关文章
|
4月前
|
Java Linux iOS开发
Linux下安装并配置Gradle
Linux下安装并配置Gradle
157 0
|
4月前
|
缓存 Java 开发工具
【开发工具】Gradle的安装 与 配置环境变量
【开发工具】Gradle的安装 与 配置环境变量
105 0
|
XML Java Apache
Gradle安装与配置
Gradle安装与配置
Gradle安装与配置
|
Java Linux Shell
Gradle下载与安装
Gradle下载与安装
1311 0
|
5月前
|
Linux 开发工具
Linux 安装gradle
Linux 安装gradle 📝1.下载gradle📜 2.将包上传到服务器,我这里下载的包是6.7的你们可以下载各自需要的版本📘3.修改配置文件📒4.查看是否成功🖊️最后总结
84 0
|
5月前
|
Java Apache Maven
Gradle安装和配置
Gradle安装和配置
346 0
|
Java Unix Shell
Gradle快速入门使用指南 - 安装篇
Gradle快速入门使用指南 - 安装篇
294 0
Gradle快速入门使用指南 - 安装篇
|
Java Apache Kotlin
Gradle系列01 Gradle介绍与安装
说明 Gradle官网 版本:gradle-5.6.4 系统:macOS Gradle简介 Gradle是一个基于Apache Ant和Apache Maven概念的项目自动化构建开源工具。它使用一种基于Groovy的特定领域语言(DSL)来声明项目设置,目前也增加了基于Kotlin语言的kotlin-based DSL,抛弃了基于XML的各种繁琐配置。
gradle_学习_01_gradle安装与基本使用
一、下载安装 1.下载地址 官方下载地址: https://gradle.org/install/#manually 下载二进制文件,解压即可   2.环境变量配置 加入以下环境变量 GRADLE_HOME=C:\dev-env\gradle\gradle-4.
1264 0
|
Java Linux iOS开发
Linux、Mac和Windows安装Gradle
一、现在的Kotlin项目,主要是基于Gradle构建的,那么首先得先了解一下Gradle。 Gradle官网:Gradle官网 官网介绍说: 1.建造任何东西 用Java,C ++,Python或您选择的语言编写。
2535 0