Testing Play framework和SBT无法使用ENV变量覆盖配置

Testing Play framework和SBT无法使用ENV变量覆盖配置,testing,intellij-idea,playframework,playframework-2.0,sbt,Testing,Intellij Idea,Playframework,Playframework 2.0,Sbt,由于某些原因,在使用SBT运行测试时,我无法覆盖配置文件中的属性 请注意,当我使用IntelliJ运行测试并从中设置环境变量时,配置文件值被正确覆盖 这就是我正在做的 application.conf: 在我的SBT文件中,我有: 我这样运行测试: sbt -DMONGO_URI=mongodb://localhost:27018/ clean test 但这不起作用 我做错了什么?您可以为测试添加如下java选项: javaOptions in test += "-DMONGO_URI=mo

由于某些原因,在使用SBT运行测试时,我无法覆盖配置文件中的属性

请注意,当我使用IntelliJ运行测试并从中设置环境变量时,配置文件值被正确覆盖

这就是我正在做的

application.conf:

在我的SBT文件中,我有:

我这样运行测试:

sbt -DMONGO_URI=mongodb://localhost:27018/ clean test
但这不起作用


我做错了什么?

您可以为测试添加如下java选项:

javaOptions in test += "-DMONGO_URI=mongodb://localhost:27018/"
sbt -DMONGO_URI=mongodb://localhost:27018/ clean test
javaOptions in test += "-DMONGO_URI=mongodb://localhost:27018/"