I would like to pass a -Dconfig.file=conf/dev.conf
parameter to my application through Build.scala when I use the run
command.
I am trying to put something like in this in my Build.scala
:
val mySettings = Seq(
(javaOptions in run) ++= Seq("-Dconfig.file=conf/dev.conf")
)
val main = play.Project(appName, appVersion, appDependencies).settings(
mySettings: _*
)
But it doesn't - from what I've gathered this is because SBT doesn't fork a new JVM when I use run. Any workarounds except of setting an environment variable?
The matter seems to be that Play runs in the same JVM as the SBT JVM so the Java options set in SBT are not used.
You can try something like:
Use fork in run := true
so that a new JVM is spawn, using the Java options you give
Launch SBT with -Dconfig.file=conf/dev.conf
Set system property manually before running the app in the same JVM: System.setProperty("config.file","conf/dev.conf")
I'm not sure all these solutions work but it's worth trying them
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With