[2.2-Scala] Add a custom start script to the dist package

1,090 views
Skip to first unread message

Ryan Tanner

unread,
Dec 16, 2013, 10:32:58 AM12/16/13
to play-fr...@googlegroups.com
If I'm using the "dist" task to create a standalone distributable, how can I add a custom start script to the bin/ folder?  I have a number of options like SSL settings that I would like to include in that but I can't figure out how to modify the SBT Native Packager to do this.  I tried appending a (File, String) tuple to mappings in Universal as the packager docs say but I can't figure out how to even make that compile.

Any ideas?

cranston

unread,
Dec 16, 2013, 10:38:03 AM12/16/13
to play-fr...@googlegroups.com

I've used the following in my build.sbt to include static files:

mappings in Universal <++= (packageBin in Compile) map { jar =>
  val scriptsDir
= new java.io.File("res/scripts/")
  scriptsDir
.listFiles.toSeq.map { f =>
    f
-> ("bin/" + f.getName)
 
}
}

Ryan Tanner

unread,
Dec 16, 2013, 12:59:44 PM12/16/13
to play-fr...@googlegroups.com
Thanks, that worked.

Christopher Hunt

unread,
Dec 16, 2013, 5:38:20 PM12/16/13
to play-fr...@googlegroups.com
If you create a dist folder in your project then it will be used as a template. Thus if you have a dist/bin with a script in it, the script will appear in your final distribution.

I've created an issue to improve our docs in order to explain this:

bryan hunt

unread,
Dec 19, 2013, 6:12:44 AM12/19/13
to play-fr...@googlegroups.com
Good tip Cranston. A quick question to the list, what does the following line mean in English?

mappings
in Universal <++= (packageBin in Compile)


I'm guessing these are scopes, or build phases.

But what are 'mappings in Universal' ?

And what does this weird symbol '<++=' mean?

Thanks,

Bryan

Christopher Hunt

unread,
Dec 19, 2013, 6:25:27 AM12/19/13
to play-fr...@googlegroups.com, play-fr...@googlegroups.com
As mentioned the supported way is to use a dist folder as a template in your project.

The 'Universal' and 'Compile' are scopes.

<++= means to append a task.

Sent from my iPhone
--
You received this message because you are subscribed to a topic in the Google Groups "play-framework" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/play-framework/lSfIhxUUOrg/unsubscribe.
To unsubscribe from this group and all its topics, send an email to play-framewor...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
Reply all
Reply to author
Forward
0 new messages