Gradle: 从 PlayBinary 分发中排除文件

Gradle: Exclude files from PlayBinary distribution

我的 build.gradle 文件中有以下配置:如何排除某些 **/*.conf 文件进入目标二进制文件?

   distributions {
            playBinary {
                baseName = 'my-service'
            }
  }

您可以使用 contents 配置分发内容,如 here . Then you can apply any filtering using CopySpec (see CopySpec API 所述)。

例如,如果您的分发根目录是 src/playBinary

distributions {
    playBinary {
        baseName = 'my-service'
        contents {
            from ('src/playBinary' ){
                exclude '**/*.conf'
            }
        }
    }
}