系统是Ubuntu14.04,安装步骤如下:
1、添加PPA仓库,执行命令:
sudo add-apt-repository ppa:cwchien/gradle
2、更新源,执行命令:
sudo apt-get update
3、查看可以安装的Gradle版本,执行命令:
apt-cache search gradle
我的系统查看结果如下:
gradle-doc - Documentation for gradle
libgradle-core-java - Groovy based build system - Core library
libgradle-plugins-java - Groovy based build system - All plugins
missidentify - a program to find win32 applications
gradle - Gradle is a Groovy based build system
gradle-ppa - Gradle is a Groovy based build system
gradle-2.10 - Gradle is a Groovy based build system
gradle-2.11 - Gradle is a Groovy based build system
gradle-2.12 - Gradle is a Groovy based build system
gradle-2.13 - Gradle is a Groovy based build system
gradle-2.14 - Gradle is a Groovy based build system
gradle-2.14.1 - Gradle is a Groovy based build system
gradle-3.0 - Gradle is a Groovy based build system
gradle-3.1 - Gradle is a Groovy based build system
4、安装目标版本,我选择安装gradle-3.1,执行命令:
sudo apt-get install gradle-3.1
5、需要注意的是,运行gradle3.1需要JDK7及其之上的版本,否则运行会给出如下提示:
FAILURE: Build failed with an exception.
* What went wrong:
Gradle 3.1 requires Java 7 or later to run. You are currently using Java 6.