本文来源于:http://blog.csdn.net/maosidiaoxian/article/details/45664943
Gradle需要1.5或更高版本的JDK.Gradle自带了Groovy库,所以不需要安装Groovy. Gradle会忽略已经安装的Groovy.Gradle会使用ptah (这里的"path"应该是指PATH环境变量.[Rover12421]译注) 中的JDK(可以使用java -version
检查). 当然,你可以配置JAVA_HOME
环境变量来指向JDK的安装目录.
Gradle requires a Java JDK to be installed. Gradle requires a JDK 1.5 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 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.
从Gralde官方网站下载Gradle的最新发行包
can download one of the Gradle distributions from the http://gradle.org/downloads
Gradle发行包是一个ZIP文件.完整的发行包包括以下内容(官方发行包有full完整版,也有不带源码和文档的版本,可根据需求下载.[Rover12421]译注):
The Gradle distribution comes packaged as a ZIP. The full distribution contains:
-
Gradle可执行文件
The Gradle binaries. -
用户手册 (有PDF 和 HTML 两种版本)
The user guide (HTML and PDF). -
DSL参考指南
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.
运行gradle必须将
加入到你的 GRADLE_HOME/bin
PATH
环境变量中.
For running Gradle, add
to your GRADLE_HOME
/bin PATH
environment variable. Usually, this is sufficient to run Gradle.
运行如下命令来检查是否安装成功.该命令会显示当前的JVM版本和Gradle版本.
gradle -v
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.
Gradle运行时的JVM参数可以通过 GRADLE_OPTS
或 JAVA_OPTS
来设置.这些参数将会同时生效. JAVA_OPTS
设置的参数将会同其它JAVA应用共享,一个典型的例子是可以在 JAVA_OPTS
中设置代理和 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 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.