我正在使用 Play Framework 2.1.x 并希望有两个测试配置,一个用于小型测试,另一个用于大型测试。大型测试需要有自定义 javaOptions 值。我有以下配置,但似乎 javaOptions 设置没有被选中。
import sbt._
import Keys._
import play.Project._
object ApplicationBuild extends Build {
val mySettings = Seq(...)
val smallTestSettings = Defaults.testSettings ++ Seq(
testOptions := Seq(Tests.Filter(smallTests))
)
val largeTestSettings = Defaults.testSettings ++ Seq(
testOptions := Seq(Tests.Filter(largeTests)),
javaOptions ++= Seq("-Dmysetting=1") // <--- PROBLEM HERE
)
lazy val SmallTest = config("smalltest") extend(Test)
lazy val LargeTest = config("largetest") extend(Test)
val main = play.Project(appName, appVersion, appDependencies)
.configs(SmallTest)
.configs(LargeTest)
.settings(mySettings: _*)
.settings(inConfig(SmallTest)(smallTestSettings): _*)
.settings(inConfig(LargeTest)(largeTestSettings): _*)
}
有趣的是,如果我将行更改为:
javaOptions in Test ++= Seq("-Dmysetting=1")
然后它确实被大型和小型测试所接受。关于如何仅为大型测试配置设置此自定义 javaOptions 的任何想法?