I can run with overriden java options my playframework application using: run -Dprop1=val1 -Dprop2=val2
. It works perfectly. But when I'm trying to do it via sbt build - props are not available.
So, I have scala file where my propject defined:
object PrjBuild extends Build {
val runSettings = Seq(
fork in run := true,
(javaOptions in run) ++= Seq(
"-Dprop1=val1",
"-Dprop2=val2")
)
lazy val root = Project(id = "my-play-project",
base = file("."),
settings = Seq(
// some options here ...
routesGenerator := InjectedRoutesGenerator
) ++ runSettings
).enablePlugins(PlayScala)
}
Please advice what am I doing wrong. I was relying on sbt fork
documentation: http://www.scala-sbt.org/0.13/docs/Forking.html
But actually I would prefer to work without fork
ing as run -Dp1=v1
does not use fork
ing. I want to perform same props setup but programmatically.
When you use run
without forking, you are using the same JVM as SBT. If you want some props to be available in this JVM, you need to start SBT with them:
sbt -Dprop1=val1 -Dprop2=val2
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.