Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save Ykid/267f14f25eaf731ebc39830bf023cca0 to your computer and use it in GitHub Desktop.
Save Ykid/267f14f25eaf731ebc39830bf023cca0 to your computer and use it in GitHub Desktop.
SBT, Scala - Pass JVM options when running tests

Use javaOptions sbt setting in Build.scala or build.sbt to pass jvm options to tests e.g.

  • statically:
javaOptions in Test ++= Seq("-Dconfig.file=conf/staging.conf")

or

  • dynamically (from command line)
javaOptions in Test ++=
  collection.JavaConversions.propertiesAsScalaMap(System.getProperties)
    .map{ case (key,value) => "-D" + key + "=" +value }.toSeq
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment