gradle项目中如何找到依赖并引入到项目中
其实
maven
和gradle
都是用来构建和管理各种项目
的工具,maven
里面是搜索pom依赖然后引入
,而gradle
呢,也是搜索依赖并引入
。
我们
只
需要正常
到https://mvnrepository.com/官网里面搜索maven依赖
,然后找到gradle版本
的就行,然后复制
到build.gradle
文件里面引入
即可,如下图所示。
gradle
添加依赖
的三种
方式
第一种(只添加一种依赖,全部写全):
compile "group":"org.springframework","name":"spring-beans","version":"5.2.5.RELEASE"
第二种(只添加一种依赖,简写):
compile "org.springframework:spring-core:5.2.5.RELEASE"
第三种(添加多种依赖):
compile(
"org.springframework:spring-core:5.2.5.RELEASE",
"org.springframework:spring-beans:5.2.5.RELEASE"
)
嗯!