Home > Software engineering >  How can I increase maxHeapSize of gradle test
How can I increase maxHeapSize of gradle test

Time:10-19

OutOfMemoryError occurs when I run gradle test. I want to increase max heap size of my test task.

I know that I can increase max heap size by defining maxHeapSize="1024m"

test {
    maxHeapSize="1024m"
}

But I don't want to change the build.gradle file.

Can I increase maxHeapSize in command line interface like ./gradlew test -DmaxHeapSize=1024m

CodePudding user response:

You can add this to gradle.properties

org.gradle.jvmargs=-Xmx1g

or at run-time

./gradlew test -Dorg.gradle.jvmargs=-Xmx1g
  • Related