1、从官网下载发布包,https://gradle.org/next-steps/?version=7.5.1&format=bin, 本文基于版本7.5.1
2、下载保存到 Downloads 目录下,文件名为 gradle-7.5.1-bin.zip
3、创建目录:mkdir /opt/gradle
4、解压 gradle-7.5.1-bin.zip 到 /opt/gradle : unzip -d /opt/gradle gradle-7.5.1-bin.zip , 如果权限不够,命令前添加 sudo
5、配置环境变量:vim ~/.bash_profile , 在最后添加一行:export PATH=$PATH:/opt/gradle/gradle-7.5.1/bin
6、验证安装是否成功:gradle -v , 如出现如下代表成功
Welcome to Gradle 7.5.1!
Here are the highlights of this release:
- Support for Java 18
- Support for building with Groovy 4
- Much more responsive continuous builds
- Improved diagnostics for dependency resolution
For more details see https://docs.gradle.org/7.5.1/release-notes.html