Skip to content

Instantly share code, notes, and snippets.

@padurean
Last active May 21, 2022 14:47
Show Gist options
  • Save padurean/f84a360a5d70c9eb7867 to your computer and use it in GitHub Desktop.
Save padurean/f84a360a5d70c9eb7867 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
@padurean
Copy link
Author

@magicliang Sorry, but i am not working with Scala and the JVM since more than 3 years now.
Perhaps you could try the approaches from the StackOverflow answers to this question
and see whether one of them works.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment