下载安装包
wget https://services.gradle.org/distributions/gradle-5.0-bin.zip -P /tmp
解压安装
sudo unzip -d /opt/gradle /tmp/gradle-5.0-bin.zip
进入目录,查看文件内容
ls /opt/gradle/gradle-5.0
bin getting-started.html init.d lib LICENSE media NOTICE
配置环境变量
新创建一个环境变量文件,
sudo nano /etc/profile.d/gradle.sh
vi /etc/profile.d/gradle.sh
export GRADLE_HOME=/opt/gradle/gradle-5.0
export PATH=${GRADLE_HOME}/bin:${PATH}
sudo chmod +x /etc/profile.d/gradle.sh
环境变量生效:
source /etc/profile.d/gradle.sh
测试命令
gradle -v
可能看到的输出:
Welcome to Gradle 5.0!
Here are the highlights of this release:
- Kotlin DSL 1.0
- Task timeouts
- Dependency alignment aka BOM support
- Interactive `gradle init`
For more details see https://docs.gradle.org/5.0/release-notes.html
------------------------------------------------------------
Gradle 5.0
------------------------------------------------------------
Build time: 2018-11-26 11:48:43 UTC
Revision: 7fc6e5abf2fc5fe0824aec8a0f5462664dbcd987
Kotlin DSL: 1.0.4
Kotlin: 1.3.10
Groovy: 2.5.4
Ant: Apache Ant(TM) version 1.9.13 compiled on July 10 2018
JVM: 1.8.0_151 (Oracle Corporation 25.151-b12)
OS: Linux 3.10.0-957.el7.x86_64 amd64
网友评论