I wanted the Play! framework dist
command to add some folders and files to the final zip file. They are needed for the application to work.
Is there a magic project/Build.scala
configuration to make it possible? I couldn't find it in the Play! documentation.
Play uses sbt-native-packager, which supports the inclusion of arbitrary files by adding them to the mappings:
mappings in Universal ++=
(baseDirectory.value / "scripts" * "*" get) map
(x => x -> ("scripts/" + x.getName))
The syntax assumes Play 2.2.x.
My Play application was not including template files (in app/views/) in the distributable, and I added them with this in Build.scala:
val main = play.Project(appName, appVersion, appDependencies).settings(
// Add your own project settings here
playAssetsDirectories <+= baseDirectory / "app/views"
)
By looking at the dist
source code, I think it is not possible.
But you can use the play clean compile stage
command to package the app and its dependencies (from doc):
This cleans and compiles your application, retrieves the required dependencies and copies them to the target/staged directory. It also creates a target/start script that runs the Play server.
Then you'll have to write your own script to add your directories and build a zip.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With