【问题标题】:Intellij and sbt: How to make intellij to read custom configuration file for my play application tests?Intellij 和 sbt:如何让 intellij 为我的游戏应用程序测试读取自定义配置文件?
【发布时间】:2017-10-28 14:40:25
【问题描述】:

对于我的测试(Play Framework 2.6 应用程序),我想使用不同的配置文件。

为此,我在build.sbt 中添加了以下行

javaOptions in Test += "-Dconfig.file=conf/application.test.conf"

当我从 sbt (sbt test) 运行测试时,它工作正常,读取自定义配置文件。

但是从 IntelliJ IDEA 运行测试时,它会忽略此设置并使用 application.conf 文件。

如何强制 IntelliJ 使用这个 sbt 设置?

【问题讨论】:

    标签: testing intellij-idea sbt playframework-2.0


    【解决方案1】:

    您必须编辑您的 intellij 配置。 为此,请使用:https://www.jetbrains.com/help/idea/creating-and-editing-run-debug-configurations.html

    进入编辑配置页面后,将 ScalaTest 添加到配置列表中。然后在VM参数下添加-Dconfig.file=conf/application.test.conf

    保存,完成!

    【讨论】:

    • 你好@Teimuraz 你明白了吗?
    • 不适用于我。 Intellij 总是为测试运行创建一个新配置,而不是使用我之前创建的配置(在 VM paras 中使用 -Dconfig.file)。
    猜你喜欢
    • 2020-03-26
    • 2015-06-09
    • 2015-11-17
    • 2013-03-02
    • 2020-07-07
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多