如何告诉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模块的依赖?