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

白话解析如下:

===========

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

Chapter 4. Installing Gradle

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.

Chapter 3. Tutorials

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.

时间: 2024-10-10 15:51:52

Spring Boot 项目构建 之 安装 Gradle(Chapter 4. Installing Gradle)的相关文章

笔记:Spring Boot 项目构建与解析

构建 Maven 项目 通过官方的 Spring Initializr 工具来产生基础项目,访问 http://start.spring.io/ ,如下图所示,该页面提供了以Maven构建Spring Boot 项目的功能. 选择构建工具 Maven Project,Spring Boot 版本选择 1.5.4,填写 Group 和 Artifact 信息,在Search for dependencies 中可以搜索需要的其他依赖包,这里我们需要实现 RESTful API,所以可以添加 Web

Spring Boot 项目构建 之 使用 Gradle 构建 Java 项目(Building Java Projects with Gradle)

Table of contents What you'll build What you'll need How to complete this guide Set up the project Install Gradle Find out what Gradle can do Build Java code Declare dependencies Build your project with Gradle Wrapper Summary Tags gradle Concepts and

Spring Boot 项目构建 之 使用 Spring Boot 构建应用(Building an Application with Spring Boot)

Table of contents What you'll build What you'll need How to complete this guide Build with Gradle Build with Maven Build with Spring Tool Suite Learn what you can do with Spring Boot Create a simple web application Create an Application class Run the

Maven快速使用教程(二) spring boot 项目构建

1.Spring boot介绍:

Java Web编程入门--spring boot 项目构建

1.clean项目 2.Maven install 注:不要Maven clean BUG: 1.参考博客 Tomcat启动时报错,Failed to start component [StandardEngine[Catalina].StandardHost[localhost].StandardContext 错误日志: 22-Aug-2017 15:25:34.939 信息 [main] org.apache.catalina.startup.VersionLoggerListener.l

使用docker构建第一个spring boot项目

在看了一些简单的docker命令之后 打算自己尝试整合一下docker+spring boot项目本文是自己使用docker+spring boot 发布一个项目1.docker介绍 docke是提供简单易用的容器接口Docker 将应用程序与该程序的依赖,打包在一个文件里面.运行这个文件,就会生成一个虚拟容器.程序在这个虚拟容器里运行,就好像在真实的物理机上运行一样.有了 Docker,就不用担心环境问题. 总体来说,Docker 的接口相当简单,用户可以方便地创建和使用容器,把自己的应用放入

构建一个简单的Spring Boot项目

11 构建一个简单的Spring Boot项目 这个章节描述如何通过Spring Boot构建一个"Hello Word"web应用,侧重介绍Spring Boot的一些重要功能.因为大多数的开发工具都支持Maven,所以我们使用它来构建这个应用. 网站 spring.io 包含了许多如何开始使用Spring Boot的指南.如果您需要解决具体的问题,可以先去这里看看.你可以跳过以下的步骤,通过 start.spring.io 网站来构建项目.这样做的话,你就可以直接编写代码啦.如果需

只需两步!Eclipse+Maven快速构建第一个Spring Boot项目

随着使用Spring进行开发的个人和企业越来越多,Spring从一个单一简洁的框架变成了一个大而全的开源软件,最直观的变化就是Spring需要引入的配置也越来越多.配置繁琐,容易出错,让人无比头疼,简化Spring配置简直可以说是民心所向. Spring Boot是由Pivotal团队提供的一个基于Java的全新的开源框架,其设计目的是用来简化新Spring应用的初始搭建以及开发过程.该框架使用了特定的方式来进行配置,从而使开发人员不再需要定义样板化的配置.如今,Spring Boot逐渐成为快

使用 Spring Boot 快速构建 Spring 框架应用--转

原文地址:https://www.ibm.com/developerworks/cn/java/j-lo-spring-boot/ Spring 框架对于很多 Java 开发人员来说都不陌生.自从 2002 年发布以来,Spring 框架已经成为企业应用开发领域非常流行的基础框架.有大量的企业应用基于 Spring 框架来开发.Spring 框架包含几十个不同的子项目,涵盖应用开发的不同方面.如此多的子项目和组件,一方面方便了开发人员的使用,另外一个方面也带来了使用方面的问题.每个子项目都有一定