I am using SBT 0.12.0. I have read other answers on stack overflow and followed them, however none of them helps, for example:
ForkRun clas
I have found the solution. No matter how you specify JVM heap size, it will never work because SBT executable already has it overridden.
There is a line in SBT executable which says:
. /usr/share/sbt/sbt-launch-lib.bash
So I edited the file:
# run sbt
execRunner "$java_cmd" \
${SBT_OPTS:-$default_sbt_opts} \
- $(get_mem_opts $sbt_mem) \
${java_opts} \
${java_args[@]} \
-jar "$sbt_jar" \
"${sbt_commands[@]}" \
"${residual_args[@]}"
Remove the - line.
Now when you run SBT, it will no longer override your JVM heap size settings. You can specify heap size settings using @Noan's answer.
Or alternatively:
sbt -J-Xmx4G -J-Xms4G