如何在 Play Framework 2 中创建 dist 期间修改 application.conf。3.x

How to modify application.conf during dist creation in Play Framework 2.3.x

我们使用 Jenkins 运行 构建 Play Framework 2.3.x 项目。这工作正常,它创建了一个打包在 zip 文件中的很好的分发。

我希望在构建过程中更新 conf 目录中的一个文件(例如 application.conf)并在变量中设置 Jenkins 构建 number/id 以便我始终可以跟踪分发文件到原始构建。

我知道可以使用 "mappings in Universal" 将文件复制到发行版,但我想改为修改现有文件。这样我就可以轻松地在页面上显示信息。

您可以使用普通的旧 Ant. With the Unzip Task you can unzip the created zip file. Then you can use the Replace Task to replace a string in your application.conf. And at least the Zip Task 再次打包您的项目。

对于更像 Scala 的方式,您可以使用 SBT Editsource.