[SOLVED] GRADLE: HOW TO INCREASE THE JAVA COMPILER’S AVAILABLE HEAP MEMORY

in java •  8 years ago 

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”
    }
}

Update:
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

Authors get paid when people like you upvote their post.
If you enjoyed what you read here, create your account today and start earning FREE STEEM!