Mac notebook installation Gradle

premise

There is a dependency between the Gradle version and the jdk version. If the version does not match, an error will be reported. Therefore, you must first confirm the gdk version corresponding to the Gradle version from the Gradle official website. The latest Gradle version needs to correspond to jdk1.8 or above

1. Download gradle

Download address: https://gradle.org/releases/ ; select binary-only to download. Choose the version you need, the recommended version is not here.

2. Choose to store the Gradle directory

Create a new directory where gradle needs to be stored, and decompress the downloaded gradle compressed package to this directory.
insert image description here

3. Configure environment variables

1. Prepare the storage path of gradle: /User/admin/desktop/java/gradle
insert image description here
2. Configure environment variables

vim ~/.bash_profile #如果权限不足,需要命令最前面加sudo之后输入密码授权
export GRADLE_HOME=/Users/admin/Desktop/java/gradle/gradle-6.9.3
export PATH=$PATH:$GRADLE_HOME/bin
修改后保存,# 如遇无法保存的情况,请尝试看一下是否是权限问题。
重新加载一下配置文件
source ~/.bash_profile

3. Check whether the installation is successful

gradle -v

得到如下结果,说明安装成功
------------------------------------------------------------
Gradle 6.9.3
------------------------------------------------------------

Build time:   2022-10-17 07:44:02 UTC
Revision:     a6198e44749b18b37e26b3b3467db17e034bcff4

Kotlin:       1.4.20
Groovy:       2.5.12
Ant:          Apache Ant(TM) version 1.10.9 compiled on September 27 2020
JVM:          18.0.2.1 (Oracle Corporation 18.0.2.1+1-1)
OS:           Mac OS X 12.3 aarch64

Guess you like

Origin blog.csdn.net/weixin_44021296/article/details/127639902