I have a single module client-server project with a main for each.
I'm trying to use sbt-native-packager
to generate start-script for both.
project/P.scala
object Tactic extends Build {
lazy val root =
(project in file(".")).
configs(Client, Server)
.settings( inConfig(Client)(Defaults.configTasks) : _*)
.settings( inConfig(Server)(Defaults.configTasks) : _*)
lazy val Client = config("client") extend Compile
lazy val Server = config("server") extend Compile
}
build.sbt
mainClass in Client := Some("myProject.Client")
mainClass in Server := Some("myProject.Server")
enablePlugins(JavaAppPackaging)
When I run client:stage
the directory target/universal/stage/lib
is created with all the necessary jars but the bin
directory is missing. What am I doing wrong?
Subsidiary question: what is the key to set the starting script name?
I would recommend setting up your project as a multi-module build, instead of creating and using new configurations. I tried your multiple configuration route and it gets hairy very quickly.
For example (I created a
shared
project for anything shared betweenclient
&server
):Note I'm enabling
sbt-native-packager
'sJavaAppPackaging
in theclient
andserver
.Then run
stage
.Also, the key for the starting script name is
executableScriptName
.