Gradle 环境安装Installation

Installation

The current Gradle release is 4.10.2. You can download binaries and view docs for all Gradle versions from the releases page.

Prerequisites

Gradle runs on all major operating systems and requires only a Java JDK or JRE version 7 or higher to be installed. To check, run java -version:

$ java -version
java version "1.8.0_121"

Additional resources

  • On-demand and live online training is available for free to Gradle users.
  • Self-paced tutorials are a good place to try Gradle with a variety of languages in addition to the docs.
  • Gradle has a new visual build inspection tool called build scans.
  • Finally, the Gradle Newsletter is a great way to keep UP-TO-DATE, with issues crafted monthly.

Install

Install with a package manager

SDKMAN! is a tool for managing parallel versions of multiple Software Development Kits on most Unix-based systems.

$ sdk install gradle 4.10.2

Homebrew is “the missing package manager for macOS”.

$ brew install gradle

Scoop is a command-line installer for Windows inspired by Homebrew.

$ scoop install gradle

Chocolatey is “the package manager for Windows”.

$ choco install gradle

MacPorts is a system for managing tools on macOS:

$ sudo port install gradle

› Additional helpful information

Install manually

Step 1. Download the latest Gradle distribution

The current Gradle release is version 4.10.2, released on 19 Sep 2018. The distribution zip file comes in two flavors:

If in doubt, choose the binary-only version and browse docs and sources online.

Need to work with an older version? See the releases page.

Step 2. Unpack the distribution

Linux & MacOS users

Unzip the distribution zip file in the directory of your choosing, e.g.:

$ mkdir /opt/gradle
$ unzip -d /opt/gradle gradle-4.10.2-bin.zip
$ ls /opt/gradle/gradle-4.10.2
LICENSE  NOTICE  bin  getting-started.html  init.d  lib  media
Microsoft Windows users

Create a new directory C:\Gradle with File Explorer.

Open a second File Explorer window and go to the directory where the Gradle distribution was downloaded. Double-click the ZIP archive to expose the content. Drag the content folder gradle-4.10.2 to your newly created C:\Gradle folder.

Alternatively you can unpack the Gradle distribution ZIP into C:\Gradle using an archiver tool of your choice.

Step 3. Configure your system environment

Linux & MacOS users

Configure your PATH environment variable to include the bin directory of the unzipped distribution, e.g.:

 $ export PATH=$PATH:/opt/gradle/gradle-4.10.2/bin
Microsoft Windows users

In File Explorer right-click on the This PC (or Computer) icon, then click Properties -> Advanced System Settings -> Environmental Variables.

Under System Variables select Path, then click Edit. Add an entry for C:\Gradle\gradle-4.10.2\bin. Click OK to save.

Step 4. Verify your installation

Open a console (or a Windows command prompt) and run gradle -v to run gradle and display the version, e.g.:

$ gradle -v

------------------------------------------------------------
Gradle 4.10.2
------------------------------------------------------------

› Additional helpful information

Upgrade with the Gradle Wrapper

If your existing Gradle-based build uses the Gradle Wrapper, you can easily upgrade by running the wrapper task, specifying the desired Gradle version:

$ ./gradlew wrapper --gradle-version=4.10.2 --distribution-type=bin

Note that it is not necessary for Gradle to be installed to use the Gradle wrapper. The next invocation of gradlew or gradlew.bat will download and cache the specified version of Gradle.

$ ./gradlew tasks
Downloading https://services.gradle.org/distributions/gradle-4.10.2-bin.zip
...

› Additional helpful information

Older Releases

You can find all releases and their checksums on the releases page.

Command-Line Completion

Command-line completion scripts are available for bash and zsh. This provides completion for Gradle tasks and command-line options.

本文参与腾讯云自媒体分享计划,欢迎正在阅读的你也加入,一起分享。

发表于

我来说两句

0 条评论
登录 后参与评论

相关文章

来自专栏Laoqi's Linux运维专列

MHA快速搭建

2916
来自专栏Netkiller

Spring boot with Thymeleaf

本文节选自电子书《Netkiller Java 手札》 5.19. Spring boot with Thymeleaf 5.19.1. Maven <dep...

36513
来自专栏用户2442861的专栏

java SLF4J 使用其他的 log框架

http://saltnlight5.blogspot.com/2013/08/how-to-configure-slf4j-with-different.ht...

1351
来自专栏Netkiller

Phalcon VS Spring 用法对照手册

Phalcon VS Spring 摘要 Phalcon VS Spring 用法对照表 ---- 目录 1. Install 1.1. Phalcon 1.2...

4186
来自专栏数据结构与算法

Codeforce GYM 100741 A. Queries

A. Queries time limit per test 0.25 s memory limit per test 64 MB input st...

28312
来自专栏技术小黑屋

Install Git Daemon on Fedora

Git-daemon is A really simple server for git repositories.You can take a detail...

891
来自专栏乐沙弥的世界

MHA 自动故障转移步骤及过程剖析

    MHA是众多使用MySQL数据库企业高可用的不二选择,它简单易用,功能强大,实现了基于MySQL replication架构的自动主从故障转移,本文主要...

1063
来自专栏用户2442861的专栏

win10 安装 Cygwin

http://preshing.com/20141108/how-to-install-the-latest-gcc-on-windows/

4953
来自专栏云知识学习

kubernetes 基础集群排障

在排错过程中,kubectl 是最重要的工具,通常也是定位错误的起点。这里也列出一些常用的命令,在后续的各种排错过程中都会经常用到。

1.4K12
来自专栏Netkiller

Spring RestFul and RestTemplate

本文节选自《Netkiller Java 手札》 10.8. Spring4 Restful @RestController 首先我要禁告各位,Spring发展...

3737

扫码关注云+社区

领取腾讯云代金券