I configured build.sbt for the unit test to use a different Play (2.3.9 for Scala and SBT 0.13.5) configuration via,
javaOptions in Test ++= Seq("-Dconfig.file=/home/kitty/acme/test/resources/test-application.conf")
Play did not pick up test-application.conf
and used application.conf
in conf
instead. AFAIK, there is no scalaOption
in this case. However, if I include -Dconfig.file
in the command line, it works fine,
sbt test -Dconfig.file=/home/kitty/acme/test/resources/test-application.conf
How do I fix this? Thanks.
javaOptions in Test ++= Seq("-Dconfig.file=/home/kitty/acme/test/resources/test-application.conf")
didn't work because my fork in Test
was false
. Therefore, set fork
to true
and it will work. -Dconfig.resource
like -Dconfig.file
works the same way too. SBT will not pick it up if it is not forked. Strictly, javaOptions
only work with fork
is true
as mentioned here
you're almost there, you can force JVM options like this
javaOptions in Test ++= Seq("-Dconfig.file=/home/kitty/acme/test/resources/test-application.conf")
config.file also takes a relative path e.g conf/test-application.conf
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