如何在gradle中下载依赖关系 [英] How to download dependencies in gradle
本文介绍了如何在gradle中下载依赖关系的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
任务compileSpeedTest(类型:JavaCompile){
classpath = files( 'build')
source = fileTree('src / test / java / speed')
destinationDir = file('bin')
}
Gradle在执行之前不会尝试下载依赖关系。
我找不到任何一个任务名称,它将它添加到列表dependsOn中。
解决方案
$ b $下载java依赖关系是可能的,如果你确实需要将它们下载到一个文件夹中。 b
示例:
apply plugin:'java'
dependencies {
运行组:'com.netflix.exhibitor',名称:'exhibitor-standalone',版本:'1.5.2'
运行组:'org.apache.zookeeper',名称:'zookeeper' ,版本:'3.4.6'
}
知识库{mavenCentral()}
源代码中的getDeps(类型:复制){
。 main.runtimeClasspath
到'runtime /'
}
下载依赖关系和它们的依赖关系)当你执行 gradle getDeps
时,到文件夹 runtime
。
I have a custom compile task.
task compileSpeedTest(type: JavaCompile) {
classpath = files('build')
source = fileTree('src/test/java/speed')
destinationDir = file('bin')
}
Gradle doesn't try to download dependencies before its execution. I cannot find anywhere a task name which does it to add it on list dependsOn.
解决方案
Downloading java dependencies is possible, if you actually really need to download them into a folder.
Example:
apply plugin: 'java'
dependencies {
runtime group: 'com.netflix.exhibitor', name: 'exhibitor-standalone', version: '1.5.2'
runtime group: 'org.apache.zookeeper', name: 'zookeeper', version: '3.4.6'
}
repositories { mavenCentral() }
task getDeps(type: Copy) {
from sourceSets.main.runtimeClasspath
into 'runtime/'
}
Download the dependencies (and their dependencies) into the folder runtime
when you execute gradle getDeps
.
这篇关于如何在gradle中下载依赖关系的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文