我需要将"myOtherResourcesDir“中的资源复制到"src/test/ resources”之前的输出目录中。看起来FileCollection不服从命令:
sourceSets.test.resources.srcDirs 'myOtherResourcesDir', 'src/test/resources' 更新:是否可以配置processTestResources任务以跳过现有文件?
发布于 2014-02-14 23:20:21
我最后用两个"from“来配置processTestResources任务。最后复制来自'src/test/resources‘的文件,以便它们覆盖来自myOtherResourcesDir的文件。
processTestResources {
from 'myOtherResourcesDir'
from 'src/test/resources'
}发布于 2014-02-14 05:25:05
你能详细说明一下你想要实现的目标吗?
这些文件将复制到processTestResources任务中。目前,无法指定复制多个目录时的顺序
我假设您需要排序的原因是,src/test/ressources中的文件覆盖了从myOtherResourcesDir复制的文件。一种选择是使用eachFile挂钩以编程方式从'myOtherResourcesDir‘中排除该文件特定的文件
processTestResources{
eachFile{fileDetails ->
if(fileDetails.file.absolutePath.contains("myOtherResourcesDir/fileToExclude.properties")){
fileDetails.exclude()
}
}
}https://stackoverflow.com/questions/21764873
复制相似问题