[SOLVED] Gradle: How to increase the Java Compiler’s available Heap Memory

The documentation is not very clear on what all the available options are…
after much Googling and many different attempts finally figured out how to raise the maximum heap of the compiler from within the gradle.build script.

apply plugin: ‘java’

compileJava {
//raise heap
options.fork = ‘true’
options.forkOptions.with {
memoryMaximumSize = “2048m”

So I’ve noticed this works great on MacOSX, but it doesn’t work at all on Windows 8.

The solution to increasing the JVM’s Heap has been to remove those options from gradle.build script and add a new file on the same folder as where your gradle.build file lives called ‘gradle.properties’

These are the contents that made it work for both Mac and Windows (I’ve still not tested this on my linux box)

org.gradle.jvmargs=-Xms256m -Xmx1024m