我正在尝试编写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文件,当我只想要特定路径中的文件时.