Matthew Gunn Matthew Gunn - 2 months ago 5x
Java Question

Gradle: set java virtual machine (jvm) stack size for task run? (eg. pass -Xss80m to jvm)

When I use gradle to execute my Java program, I'd like to manually set the stack size. With normal command line, it would be something like java -Xss80m.

I'm new to Gradle and struggling a bit to find the best or standard way to do this...

Excerpt of my Gradle build script is below:

task run(type: JavaExec) {
classpath += sourceSets.main.runtimeClasspath
main = 'loadBuybackRowsIntoSQL'


According to docs, jvmArgs is what you need:

task run(type: JavaExec) {
    jvmArgs '-Xss80m' // will add this argument to list
    // or
    jvmArgs = ['-Xss80m'] // will replace arguments list