码迷,mamicode.com
首页 > 编程语言 > 详细

Spring Boot 项目构建 之 安装 Gradle(Chapter 4. Installing Gradle)

时间:2015-08-01 17:23:54      阅读:151      评论:0      收藏:0      [点我收藏+]

标签:


白话解析如下:

===========

Mac 系统下载到 Gradle 压缩包后,解压到某一目录下,然后设置环境变量,命令如下:

vi ~/.profile 

按 i 进行编辑模式,用方向键向下移动光标到末尾,并添加如下内容:

export GRADLE_HOME=/xxx/yyy/.../gradle-2.5
export PATH=$GRADLE_HOME/bin:$PATH

按 ESC 键退出编辑模式,输入 w 回车保存,再输入 q 回车退出 vi 编辑器。

接下来测试 gradle 是否可用,新开一个终端即命令行窗口,输入:

gradle -v

回车执行后,会出现如下内容,表示已成功安装可用:

------------------------------------------------------------
Gradle 2.5
------------------------------------------------------------

Build time:   2015-07-08 07:38:37 UTC
Build number: none
Revision:     093765bccd3ee722ed5310583e5ed140688a8c2b

Groovy:       2.3.10
Ant:          Apache Ant(TM) version 1.9.3 compiled on December 23 2013
JVM:          1.8.0_40 (Oracle Corporation 25.40-b25)
OS:           Mac OS X 10.10.4 x86_64


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 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.

4.2. Download

You can download one of the Gradle distributions from the Gradle web site.

4.3. Unpacking

The Gradle distribution comes packaged as a ZIP. The full distribution contains:

  • The Gradle binaries.

  • The user guide (HTML and PDF).

  • The DSL reference guide.

  • 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 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 theGradle 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.

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.

4.6. JVM options

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 thegradle or gradlew script.

Note that it‘s not currently possible to set JVM options for Gradle on the command line.


3.1. Getting Started

The following tutorials introduce some of the basics of Gradle, to help you get started.

Chapter 4, Installing Gradle

Describes how to install Gradle.

Chapter 6, Build Script Basics

Introduces the basic build script elements: projects and tasks.

Chapter 7, Java Quickstart

Shows how to start using Gradle‘s build-by-convention support for Java projects.

Chapter 8, Dependency Management Basics

Shows how to start using Gradle‘s dependency management.

Chapter 9, Groovy Quickstart

Using Gradle‘s build-by-convention support for Groovy projects.

Chapter 10, Web Application Quickstart

Using Gradle‘s build-by-convention support for Web applications.


The latest release of Gradle is version 2.5, released on 8th July 2015.










Spring Boot 项目构建 之 安装 Gradle(Chapter 4. Installing Gradle)

标签:

原文地址:http://blog.csdn.net/opengl_es/article/details/47187283

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!