【发布时间】:2021-05-11 10:19:47
【问题描述】:
我正在尝试编写一个 Gradle 任务来将特定文件从深层树复制到平面文件夹中。
第一次尝试:
task exportProperties << {
copy {
from "."
into "c:/temp/properties"
include "**/src/main/resources/i18n/*.properties"
}
}
这会复制正确的文件,但不会使结构变平,所以我最终得到了原始项目中的每个文件夹,其中大部分都是空的。
第二次尝试,根据我看到的答案here 和here:
task exportProperties << {
copy {
from fileTree(".").files
into "c:/temp/properties"
include "**/src/main/resources/i18n/*.properties"
}
}
这一次,它没有复制任何东西。
第三次尝试:
task exportProperties << {
copy {
from fileTree(".").files
into "c:/temp/properties"
include "*.properties"
}
}
几乎可以工作,除了当我只想要特定路径中的文件时它会复制每个 *.properties 文件。
【问题讨论】:
标签: gradle