gradle入门

285 阅读1分钟

gradle是什么?

和maven一样,就是一个jar仓库。

如何使用?

  1. 下载
  2. 解压缩
  3. 配置环境变量

和安装maven一样。无需安装,只需要解压缩就可以使用。

mac配置环境变量

打开配置文件

gongzhihaodeMacBook-Pro:/ gongzhihao$ sudo vi ~/.bash_profile

添加配置

#gradle
export GRADLE_HOME=/Users/gongzhihao/Downloads/gradle-7.2
PATH=${PATH}:${GRADLE_HOME}/bin
export PATH

检查是否安装成功

gongzhihaodeMacBook-Pro:/ gongzhihao$ gradle -v

Welcome to Gradle 7.2!

Here are the highlights of this release:
 - Toolchain support for Scala
 - More cache hits when Java source files have platform-specific line endings
 - More resilient remote HTTP build cache behavior

For more details see https://docs.gradle.org/7.2/release-notes.html


------------------------------------------------------------
Gradle 7.2
------------------------------------------------------------

Build time:   2021-08-17 09:59:03 UTC
Revision:     a773786b58bb28710e3dc96c4d1a7063628952ad

Kotlin:       1.5.21
Groovy:       3.0.8
Ant:          Apache Ant(TM) version 1.10.9 compiled on September 27 2020
JVM:          1.8.0_181 (Oracle Corporation 25.181-b13)
OS:           Mac OS X 10.13.6 x86_64

gongzhihaodeMacBook-Pro:/ gongzhihao$

参考

官方文档

gradle.org/install/

www.geek-share.com/detail/2758…

www.jianshu.com/p/001abe1d8…