Thus, using the Scala Play Framework. I have one code base, but I need to start it in two ways. One way starts with Play Netty as the main class and starts the web server. The second way would be to run my own main class and do different things.
If I play dist ( https://www.playframework.com/documentation/2.3.x/ProductionDist )
It ends up using the sbt-native plugin and creates a new zip code. Inside this zip is a script that calls java with the main Netty class. It ultimately comes from
mainClass in (Compile, run) := Some("play.core.server.NettyServer"),
inside PlaySettings.scala.
I want to save all this, but add a second artifact for dist .. which is different only from another main class.
I started trying to create subprojects .. but not sure if this is what I really want. Sort of:
lazy val root = Project( id = "root", base = file("."), librar aggregate = Seq(web, backend) ).dependsOn(web, worker) lazy val web = Project( id = "web", base = file("."), settings = packageArchetype.java_server ++ Seq( name := "web", mainClass in Compile := Some("play.core.server.NettyServer") ) ).enablePlugins(PlayScala) lazy val backend= Project( id = "backend", base = file("."), settings = packageArchetype.java_server ++ Seq( name := "backend", mainClass in Compile := Some("com.foobar.BackendMain") ) )
But I still remain the only artifact. What other options are there?
I could hack bash -template and add mainClass as a parameter and pass it to the script to run ...