How can I change JVM settings for a single Gradle task / project?

I have a bunch of gradle projects and sub-projects. I am trying to change the JVM arguments for one subproject because it is a suite of unit tests that require a lot of memory, so I want to add '-Xms2g -Xmx4g'

to the VM when I do exactly that target.

Is there a way to do this? The only concrete ways I have found in the documentation is to install _JAVA_OPTIONS

in an environment, or org.gradle.jvmargs="-Xms2g -Xmx4g"

in a gradle.properties

script, but both of these force all targets to use those options.

I am new to gradle, so pointers to specific documents that cover the properties of each task are especially welcome.

+3


source to share


1 answer


Yes, it can be done with any task that implements JavaForkOptions .



test {
    minHeapSize = '2g'
    maxHeapSize = '4g'
}

      

+4


source







All Articles