一、安装包下载
wget https://downloads.gradle.org/distributions/gradle-4.10-bin.zip
下载到自定义目录中
二、解压
[root@localhost ~]# unzip gradle-4.10-bin.zip
三、加入到PATH环境变量中
[root@localhost bin]# export PATH=$PATH:/root/gradle-4.10/bin/
[root@localhost hbk]# source /etc/profile
[root@localhost hbk]# gradle -version
Welcome to Gradle 4.10!
Here are the highlights of this release:
- Incremental Java compilation by default
- Periodic Gradle caches cleanup
- Gradle Kotlin DSL 1.0-RC3
- Nested included builds
- SNAPSHOT plugin versions in the `plugins {}` block
For more details see https://docs.gradle.org/4.10/release-notes.html
------------------------------------------------------------
Gradle 4.10
------------------------------------------------------------
Build time: 2018-08-27 18:35:06 UTC
Revision: ee3751ed9f2034effc1f0072c2b2ee74b5dce67d
Kotlin DSL: 1.0-rc-3
Kotlin: 1.2.60
Groovy: 2.4.15
Ant: Apache Ant(TM) version 1.9.11 compiled on March 23 2018
JVM: 1.8.0_181 (Oracle Corporation 25.181-b13)
OS: Linux 3.10.0-693.el7.x86_64 amd64
简单构建
新建一个build.gradle文件,内容如下:
task hello {
doLast {
println 'Hello huangbaokang!'
}
}
使用如下命令进行构建
[root@localhost hbk]# gradle -q hello
Hello huangbaokang!
[root@localhost hbk]#