使用不同的jvm参数运行sbt

时间:2015-09-15 09:55:04

标签: jvm sbt jvm-arguments

在我的build.sbt中:

name := "test"

version := "1.0"

scalaVersion := "2.10.5"

fork in run := true

outputStrategy := Some(StdoutOutput)

javaOptions in run += "-XX:MaxPermSize=1024M"

javaOptions in run += "-XX:PermSize=1024M"

javaOptions in run += "-Xmx50G"

javaOptions in run += "-Xms50G"

我的java选项是静态的,我想在命令行中启动应用程序时动态设置Xms和Xmx。类似的东西:

#sbt "run-main Main" arg_xmx arg_xms

Hypotetic build.sbt:

javaOptions in run += "-Xmx<arg_xmx>G"

javaOptions in run += "-Xms<arg_xms>G"

有办法做到这一点吗?

1 个答案:

答案 0 :(得分:0)

这不是我正在寻找的方法,但结果是一样的。我感谢这个post

#sbt '; set javaOptions += "-Xms4G" ; set javaOptions += "-Xmx4G" ; run-main job.Main'