【发布时间】:2015-11-05 09:57:09
【问题描述】:
我有一个 gradle 脚本,它基本上将 jar 从我们公司的存储库中提取到当前工作目录中。
我想做的是添加一个任务,该任务还将 ivy.xml 文件提取到另一个目录中。
build.gradle 看起来像这样:
repositories {
ivy {
url 'protocol://repo.foocompany.com/'
credentials {
username "foo"
password "bar"
}
layout 'pattern', {
artifact '[organisation]/[module]/[module]-[revision].[ext]'
ivy '[organisation]/[module]/ivy-[revision].xml'
}
}
dependencies {
compile 'com.foocompany:bartifact:rev@ext'
}
task list << {
configurations.compile.each {
File file -> println file.name
}
}
// that's the part I actually use
task fetch(type: Copy) {
from configurations.compile
into System.getProperty("user.dir")
}
task fetchXml {
// and that's where I'm stuck no clue what I should put in there
}
运行脚本时,我的 fetch 任务按预期工作:
$> gradle fetch
Download protocol://repo.foocompany.com/com.foo/bartifact/ivy-rev.xml
Download protocol://repo.foocompany.com/com.foo/bartifact/bartifact-rev.ext
:fetch
$> ls
bartifact-rev.ext
而且我无法获取该 XML 文件。 我一直在尝试很多东西,但除了手动,我无法从 gradle 的缓存中获取它。
【问题讨论】: