gradle安装

Installation

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_60"

Zero-installation with the Gradle Wrapper

If you’re working with an existing Gradle-based build that uses the Gradle Wrapper, you don’t need to install anything up front. Just run the gradlew shell script on Unix-based systems, or run the gradlew.bat script on Windows.

These wrapper scripts will locate and use the correct version of Gradle if it is already installed on your system, and will otherwise download and install the correct version of Gradle on your behalf. For example, on a system that does not yet have Gradle installed, gradlew tasks will produce the following output:

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

Install with a package manager

SDKMAN!

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

$ sdk install gradle 3.3

Homebrew

Homebrew is “the missing package manager for macOS”.

$ brew install gradle

Chocolatey

Chocolatey is “the package manager for Windows”.

C:\> choco install gradle

Install manually

Step 1. Download the latest Gradle distribution

The current Gradle release is version 3.3, released on 03 Jan 2017. 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

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

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

Step 3. Configure your system environment

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

 $ export PATH=$PATH:/opt/gradle/gradle-3.3/bin

Step 4. Verify your installation

Run gradle -v to run gradle and display the version, e.g.:

$ gradle -v

------------------------------------------------------------
Gradle 3.3
------------------------------------------------------------

Extras

Bash and Zsh completion scripts

See https://github.com/eriwen/gradle-completion.

posted @ 2017-02-16 17:49  小学生II  阅读(899)  评论(0编辑  收藏  举报