我有一个自定义编译任务。
task compileSpeedTest(type: JavaCompile) {
classpath = files('build')
source = fileTree('src/test/java/speed')
destinationDir = file('bin')
}
Gradle 在执行之前不会尝试下载依赖项。
我在任何地方都找不到一个任务名称来将它添加到列表中。
最佳答案
如果您确实需要将它们下载到文件夹中,则可以下载 Java 依赖项。
例子:
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/'
}
将依赖项(及其依赖项)下载到文件夹
runtime
当你执行 gradle getDeps
.
关于gradle - 如何在gradle中下载依赖项,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21814652/