For the complete documentation index, see llms.txt. This page is also available as Markdown.

java.lang.OutOfMemoryError: Java heap space

For large projects with many classes to parse, the default JVM heap size might not suffice. If you encounter java.lang.OutOfMemoryError: Java heap space error consider increasing the maxHeapSize for the test source set:

Add the following argument to thebuild.gradle.kts file:

tasks.withType<Test> {
    maxHeapSize = "1g"
}

Add the following argument to the build.gradle file:

tasks.withType(Test).configureEach { 
    maxHeapSize = "1g" 
}

Add the following argument to the pom.xml file:

<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-surefire-plugin</artifactId>
    <version>3.0.0</version>
    <configuration>
        <argLine>-Xmx1g</argLine>
    </configuration>
</plugin>

You may need to set larger value than 1 gigabyte.

Last updated