3

我如何告诉 gradle 下载一些依赖项以及何时下载它们?例如这是我的代码:

configurations {
    ivydep
}

repositories {
    ivy {
        url "http://my.ivy.repo/ivyrep/shared"
        layout "pattern", {
            artifact "[organisation]/[module]/[revision]/[type]s/[artifact].[ext]"
        }
    }
}

dependencies {
    ivydep "eu.company:MyList:1.0.1"
}

task resolve << {
    println 'configurations.ivydep.singleFile: '+configurations.ivydep.singleFile
    // dependency is a zip so I need to unzip it
    copy {
        from zipTree(configurations.ivydep.singleFile)
        into "${buildDir}/temp"
    }
}

我希望 gradle 在resolve调用任务时下载依赖项,但我该怎么做?问题是 gradle 有时会下载依赖项,有时不会。据我了解,gradle 缓存是。如何告诉 gradle 以编程方式下载依赖项或如何设置对 ivy 模块的依赖项?

4

0 回答 0