Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
659 views
in Technique[技术] by (71.8m points)

playframework - How do I specify a config file with sbt 0.12.2 for sbt test?

I have a Play! project with unit tests and I am trying to run tests on my staging environment using sbt. Before I upgraded to Play 2.1, when I was using Play 2.0.4 and sbt 0.11.3 I could do $ sbt -Dconfig.file=conf/staging.conf test. Now sbt test seems to use the default application.conf no matter what I specify for -Dconfig.file.

sbt start -Dconfig.file=conf/staging.conf still works fine. Is this behavior a bug with sbt 0.12.2 or should I be specifying a config file for running tests in a different way?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

test is using forked jvm. Use javaOptions sbt setting to pass jvm options to it e.g.

javaOptions ++= Seq("-Dconfig.file=conf/staging.conf")
or

javaOptions ++= collection.JavaConversions.propertiesAsScalaMap(System.getProperties).map{ case (key,value) => "-D" + key + "=" +value }.toSeq


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...