gradle 添加依赖
示例
Gradle中的依赖项遵循与Maven相同的格式。依赖关系的结构如下:
group:name:version
这是一个例子:
'org.springframework:spring-core:4.3.1.RELEASE'
要添加为编译时依赖项,只需dependency在Gradle构建文件的代码块中添加以下行:
compile 'org.springframework:spring-core:4.3.1.RELEASE'
为此的另一种语法可以显式地命名依赖项的每个组件,如下所示:
compile group: 'org.springframework', name: 'spring-core', version: '4.3.1.RELEASE'
这在编译时增加了依赖性。
您也可以仅为测试添加依赖项。这是一个例子:
testCompile group: 'junit', name: 'junit', version: '4.+'
热门推荐
10 财运虎年祝福语简短语
11 单亲爸爸春节祝福语简短
12 狗狗上厕所训练
13 植物种植祝福语简短
14 翻译考试祝福语朋友简短
15 个人周年庆简短祝福语
16 狗狗怎么训练
17 分别祝福语简短搞笑英文
18 生日广州男生祝福语简短