how to increase max memory usage in build.sbt

I have a


file that looks something like this

lazy val `tokens-service` = (project in file("modules/some-service"))
    publishArtifact  := false,
    name             := "example",
    buildInfoPackage := "com.some.path",
    javaAgents ++= d.JavaAgents,
    libraryDependencies ++= List.concat(

I want to set the max heap memory to 4352M, I tried adding this line to my module settings

scalacOptions += "-JXmx4352M"

and also

javaOptions += "-JXmx4352M"

Then I run

sbt example/Universal/stage

However, when I check the shell script produced by sbt which I think should be in this path


I don't see the max heap being set anywhere. I was expecting to see the new parameter JXmx4352M being passed in. Does anyone know what I'm doing wrong? Maybe I'm looking in the wrong scripts and it is working? I would like to know how to verify this new parameter is being passed in the script produced by sbt and would appreciate any help


  • You need to scope your javaOptions like Universal / javaOptions += ...