Java:Gradle 下载项目依赖


#Java 工具#


示例 1

在 build.gradle 中添加任务:

task getDeps(type: Copy) {
  from sourceSets.main.runtimeClasspath
  into 'runtime/'
}

运行 gradle getDeps,会将依赖的jar下载到 runtime 目录。

示例 2

在 build.gradle 中添加任务:

task copyDeps(type: Copy) {
    from (configurations.compile + configurations.testCompile) {
        include "*.jar"
        include "*.so", "*.dll"
    }
    into rootProject.rootDir.getAbsolutePath() + "/lib"
}

运行 gradle copyDeps,会将依赖的jar下载到 lib 目录。

参考


( 本文完 )