我尝试使用Gradle同步dir中的特定文件。但我得到一个奇怪的错误,我似乎无法解决。如果在同步时有更好的(工作)方式来过滤文件,那也是受欢迎的。
实施1
def updateAbstractsContentSpec = copySpec {
from('../../base') {
includes "../../base/shared/**/*_abstract.*"
}
}
task updateAbstracts(type: Sync) {
group 'build'
with updateAbstractsContentSpec
}
错误1
Error:(24, 0) Could not find method includes() for arguments [../../base/shared/**/*_abstract.*] on object of type org.gradle.api.internal.file.copy.CopySpecWrapper_Decorated.
实施2(优先)
task updateAbstracts(type: Sync) {
group 'build'
from '../../base'
includes '../../base/shared/**/*_abstract.*'
}
错误2
Error:(23, 0) Could not find method includes() for arguments [../../base/shared/**/*_abstract.*] on task ':apps:TestApp1:updateAbstracts' of type org.gradle.api.tasks.Sync.
我认为它清楚我尝试做什么。我希望有人可以帮助我。
答案 0 :(得分:1)
自Gradle 3.0 CopySpec documentation起, CopySpec
不包含includes
方法。
您应该使用include:
task updateAbstracts(type: Sync) {
group 'build'
from '../../base'
include '../../base/shared/**/*_abstract.*'
}