![](/img/trans.png)
[英]Intellij and sbt: How to make intellij to read custom configuration file for my play application tests?
[英]Play framework and SBT fail to override configuration with ENV variable
由于某些原因,在使用SBT运行测试时,我无法覆盖配置文件中的属性。
请注意,当我使用IntelliJ运行测试并从那里设置环境变量时,配置文件值将被正确覆盖。
这是我在做什么
application.conf:
mongodb.uri = "mongodb://mongodb:27017/" mongodb.uri = ${?MONGO_URI}
在我的SBT文件中,我有:
fork in run := false fork in test := false
我像这样运行测试:
sbt -DMONGO_URI=mongodb://localhost:27018/ clean test
但这是行不通的。
我究竟做错了什么?
您可以像这样添加Java选项进行测试:
javaOptions in test += "-DMONGO_URI=mongodb://localhost:27018/"
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.