如何从 processResources Gradle 任务中排除多个文件

Sus*_*a M 3 gradle build.gradle

我必须从 processResources gradle 任务中排除 xsl 和 xsd 类型的文件。目前,我只排除了 xsl 文件和我的 build.gradle 片段,如下所示:

processResources {
filesNotMatching("**/*.xsl") {
    expand(project.properties)
}
dependsOn versionInfo
}
Run Code Online (Sandbox Code Playgroud)

我还想通过包含生成的类所属的包的模式来排除扩展名为 xsd 的文件。我已经明白 filesNotMatching 函数不接受多个参数。这样做的替代方法是什么?

Ale*_*lor 6

filesNotMatching可以采用String模式或Iterable<String>. 这意味着代码可以是:

processResources {
    filesNotMatching(["**/*.xsl", "**/*.xsd"]) {
        expand(project.properties)
    }
    dependsOn versionInfo
}
Run Code Online (Sandbox Code Playgroud)