通过gradle解决ivy依赖关系

时间:2013-05-24 11:40:01

标签: groovy gradle

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

0 个答案:

没有答案