SBT Specify java heap size in Build.scala

前端 未结 1 500
野性不改
野性不改 2021-01-13 12:38

My Build.scala file contents.

val commonSettings = Seq(
version := \"1.0.0\",
organization := \"com.collective\",
scalaVersion := \"2.11.4\",
scalacOptions +         


        
相关标签:
1条回答
  • 2021-01-13 13:29

    If you want to change the heap size, you need to tell sbt to fork another JVM (this applies to any JVM option by the way). You can use the fork setting to do so:

    fork in run := true
    

    Also, you want to make sure, that your options are properly separated (there is no additional parsing done by sbt):

    javaOptions in run ++= Seq(
        "-Xms256M", "-Xmx2G", "-XX:MaxPermSize=1024M", "-XX:+UseConcMarkSweepGC")
    

    Alternatively, you can set the heap size in the sbt runner. If you are using normal sbt, you can modify the launcher script directly. If you are using sbt-extras, you can pass arguments to the JVM using the -J flag:

    sbt -J-Xmx2G # etc.
    
    0 讨论(0)
提交回复
热议问题