0

I am getting gradle build out of memory : Java heap space issue when trying to build Spring application which has multiple modules with gradle build tool. using IntelliJ 2022.2.2 ultimate edition. Gradle version - 8.1

I have tried to change gradle.properties also with following details:


systemProp.sonar.host.url= {sonar_url}
systemProp.sonar.login={login_details}
org.gradle.jvmargs=-Xmx4096M

Also tried to change memory settings from help menu, invalidating caches, but it is not working. Could anyone help with a permanent solution for this error???

Sia
  • 1
  • Try Increasing heap size in intellij. From settings select Build, Execution, Deployment . Compiler, and specify the necessary amount of memory in the Shared build process heap size field. – rahulP Jul 12 '23 at 09:45
  • Does the same error occur when you build project from the command line with Gradle outside of the IDE? Attach a complete error stacktrace in a text format and clarify what actions in the IDE trigger this problem – Egor Klepikov Jul 12 '23 at 10:12
  • I have tried increasing Shared Build process heap size also from settings. – Sia Jul 12 '23 at 12:04
  • From command line if I try with gradle clean build its building properly. But gradle is not loading changes in the application. `Starting Gradle Daemon... Gradle Daemon started in 2 s 283 ms > Task :prepareKotlinBuildScriptModel UP-TO-DATE FAILURE: Build failed with an exception. * What went wrong: Java heap space * Try: > Run with --info or --debug option to get more log output. > Run with --scan to get full insights. * Exception is: java.lang.OutOfMemoryError: Java heap space at org.gradle.internal.io.StreamByteBuffer$StreamByteBufferChunk.(StreamByteBuffer.java:311)` – Sia Jul 12 '23 at 12:27
  • How much RAM does your computer have and how much of it is free when you run the build? Which OS are you using? Can you confirm you are using gradle.properties and not gradle-wrapper.properties? Has the Project ever built successfully on your machine? Would you be able to share it? Try adding the following: org.gradle.jvmargs=-Xms512M -Xmx4g -XX:MaxPermSize=1024m -XX:MaxMetaspaceSize=1g -Dkotlin.daemon.jvm.options="-Xmx1g" – romanv-jb Jul 17 '23 at 12:57

0 Answers0