Search code examples
javascalasbtjavac

SBT Set javac max heap


I'm trying to compile some very large Java source files in a Scala/SBT project. How can I set the max heap size for the Java Compiler (javac).

Setting

javacOptions in Compile ++= Seq("-target", "1.7", "-source", "1.7", "-Xmx1g")

fails with an invalid argument exception on -Xmx1g... Setting -J-Xmx2g give similar errors.

Is there a way I can fork javac?

Using sbt v 0.13.8


Solution

  • As you've noticed this seems to be a bug introduced in sbt 0.13.8, see #1968.

    The workaround is to downgrade to 0.13.7 where this doesn't happen.