给定一个声明为gradle依赖项的zip文件
dependencies {
orientdb(group: "com.orientechnologies", name: "orientdb-community", version: orientdbVersion, ext: "zip")
}
字符串
它包含以下结构的文件
.
└── orientdb-community-2.2.33
├── benchmarks
│ ├── bench_memory_get.bat
│ └── post.txt
├── bin
│ ├── backup.sh
...
型
可以使用以下任务将zip内容同步到给定的目标目录中,从而保留zip的完整结构:
task("deploy-db", type: Sync) {
from(configurations.orientdb.collect { zipTree(it) })
into(orientdbTgt)
}
型
我如何配置上述任务以从结果中删除"orientdb-community-$orientdbVersion"
目录,以便输出为:
/${orientdbTgt}
├── benchmarks
│ ├── bench_memory_get.bat
│ └── post.txt
├── bin
│ ├── backup.sh
...
型
信息:rename("(.*/)orientdb-community-$orientdbVersion/(.+)", '$1$2')
似乎不工作,因为它只作用于文件名,这里的重命名涉及路径。
1条答案
按热度按时间ttygqcqt1#
使用Gradle 4.5.1,以下是一个合理的传真,它的工作。
它在
Sync
任务上使用eachFile
(doc)功能。下面,我们更改eachFile
传递的FileCopyDetails
对象上的路径。字符串