Can I use both in my project?
Previously I had only object extending App
trait, but since I started using Microkernel
I need to have class extending Bootable
trait.
Let's say that I have something like this:
lazy val backend = (project in file("backend"))
.enablePlugins(AkkaAppPackaging)
.enablePlugins(UniversalPlugin)
.settings(
name := "backend",
mainClass in Compile := Some("backend.Backend"),
libraryDependencies ++= Dependencies.backend,
javaOptions in run ++= Seq("-Djava.library.path=./sigar"),
fork in run := true)
.dependsOn(api)
.aggregate(api)
and Backend class like this:
class Backend extends Bootable {
val system = ActorSystem("mobile-cluster")
def startup() = {
FactorialBackend startOn system
}
def shutdown() = {
system.shutdown()
}
}
I cannot start app with sbt run
(there is an error about missing static main method), but it works with Microkernel, when I run sbt stage
and next start application using generated script it works fine.
When I'm using something like this:
object Backend extends App {
val system = ActorSystem("application")
FactorialBackend startOn system
}
I can start app with sbt "project backend" "run"
, but Microkernel doesn't work anymore.
What can I do with that? Should I have separate files for starting application with Microkernel and sbt or separate build configurations?
I need to have a production version of application using Microkernel and I also want to just run and debugging my application during development using sbt.
I tried to use the same class or object extending both, App and Bootable trait or configure sbt.build to have separate configuration for Microkernel and sbt run
, but it didn't help.