【转载】Gradle学习 第四章:安装Gradle

转载地址:http://ask.android-studio.org/?/article/16

 

4.1. Prerequisites 前提条件
Gradle requires a Java JDK or JRE to be installed, version 6 or higher (to check, use java -version). Gradle ships with its own Groovy library, therefore Groovy does not need to be installed. Any existing Groovy installation is ignored by Gradle.
<翻译> Gradle需要安装1.6及以上版本的Java JDK或JRE(使用java -version来查看当前版本)。Gradle拥有自己的Groovy库,因此不需要另行安装Groovy。任何已安装的Groovy都会被Gradle给忽略。

Gradle uses whatever JDK it finds in your path. Alternatively, you can set the JAVA_HOME environment variable to point to the installation directory of the desired JDK.
<翻译> Gradle使用环境变量中设置的JDK。另外,你可以设置JAVA_HOME环境变量来只想你所需要使用的JDK。

4.2. Download 下载
You can download one of the Gradle distributions from the Gradle web site.
<翻译> 你可以在Gradle网站下载。

4.3. Unpacking 解包
The Gradle distribution comes packaged as a ZIP. The full distribution contains:
<翻译> Gradle打包成了Zip包。完整版包含以下内容:

The Gradle binaries. Gradle二进制文件
The user guide (HTML and PDF). 用户向导(HTML和PDF版)
The DSL reference guide. DSL引用向导
The API documentation (Javadoc and Groovydoc). API文档(Javadoc 和 Groovydoc)
Extensive samples, including the examples referenced in the user guide, along with some complete and more complex builds you can use as a starting point for your own build.
<翻译> 大量的示例

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. Environment variables 环境变量
For running Gradle, add GRADLE_HOME/bin to your PATH environment variable. Usually, this is sufficient to run Gradle.
<翻译> 为了运行Gradle,添加GRADLE_HOME/bin到你的PATH环境变量。通常,这就足以运行Gradle。

4.5. Running and testing your installation 运行并测试你的安装
You run Gradle via the gradle command. To check if Gradle is properly installed just type gradle -v. The output shows the Gradle version and also the local environment configuration (Groovy, JVM version, OS, etc.). The displayed Gradle version should match the distribution you have downloaded.
<翻译> 你可以通过gradle命令来运行Gradle。输入gradle -v检查Gradle是否安装正常。输出内容将显示Gradle版本和一些本地环境配置(Groovy,Java虚拟机版本,操作系统等等)。Gradle版本号应该和你下载的是匹配的。

4.6. JVM options Java虚拟机选项
JVM options for running Gradle can be set via environment variables. You can use either GRADLE_OPTS or JAVA_OPTS, or both. JAVA_OPTS is by convention an environment variable shared by many Java applications. A typical use case would be to set the HTTP proxy in JAVA_OPTS and the memory options in GRADLE_OPTS. Those variables can also be set at the beginning of the gradle or gradlew script.
<翻译> 运行Gradle的Java虚拟机选项可以有环境变量来设置。你可以使用GRADLE_OPTS,JAVA_OPTS或者同时使用。JAVA_OPTS是共享给许多Java应用程序的共享环境变量。一个典型的用例就是在JAVA_OPTS中设置HTTP代理,在GRADLE_OPTS中设置内存选项。这些变量也可以设置在gradle或gradlew脚本的开头。

Note that it's not currently possible to set JVM options for Gradle on the command line.
<翻译> 备注:现在不支持使用命令行为Gradle设置Java虚拟机选项。

原文地址:http://www.gradle.org/docs/cur ... .html
翻译者:wellchang
邮箱:2483808264@qq.com

如对翻译内容有异议,请在评论区提出或联系作者
posted @ 2016-04-24 16:33  wust小吴  阅读(229)  评论(0编辑  收藏  举报