当我使用 gradle 6.0 构建多模块 java 项目时,当我添加 >30 个模块时。抛出此错误:
Gradle Daemon started in 2 s 267 ms
> Configure project :soa-misc
"/opt/dabai/tools/jdk1.8.0_211/jre/lib/ext/"
null
Expiring Daemon because JVM heap space is exhausted
Daemon will be stopped at the end of the build after running out of JVM memory
Expiring Daemon because JVM heap space is exhausted
Expiring Daemon because JVM heap space is exhausted
Expiring Daemon because JVM heap space is exhausted
Expiring Daemon because JVM heap space is exhausted
Expiring Daemon because JVM heap space is exhausted
Expiring Daemon because JVM heap space is exhausted
Expiring Daemon because JVM heap space is exhausted
Expiring Daemon because JVM heap space is exhausted
Expiring Daemon because JVM heap space is exhausted
Expiring Daemon because JVM heap space is exhausted
Expiring Daemon because JVM heap space is exhausted
Daemon is stopping immediately JVM garbage collector thrashing and after running out of JVM memory
我试图在我的
$HOME/.gradle/gradle.properties
中添加参数:org.gradle.jvmargs=-Xmx8096m -XX:MaxPermSize=8096m -XX:+HeapDumpOnOutOfMemoryError
但是问题没有解决,我该怎么解决?
最佳答案
我在我的根项目目录中添加 gradle.properties 文件,并添加此配置:
org.gradle.jvmargs=-Xmx4096M
作品。从错误消息中我们可以知道 Daemon JVM 空间已耗尽。这是 Gradle official docuemnt关于这个配置:Specifies the JVM arguments used for the Gradle Daemon. The setting is particularly useful for configuring JVM memory settings for build performance. This does not affect the JVM settings for the Gradle client VM. The default is -Xmx512m "-XX:MaxMetaspaceSize=256m".
关于java - 守护进程立即停止 JVM 垃圾收集器抖动并在 JVM 内存耗尽后停止,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59624003/