Intellij IDEA 中的 Maven 导入在大型项目上内存不足

Maven import in Intellij IDEA runs out of memory on a large project

Maven 项目导入结束于

Exception java.lang.OutOfMemoryError: GC overhead limit exceeded
  1. 我尝试定义一个环境变量:MAVEN_OPTS = -Xmx1g
  2. 我尝试通过设置 -> 构建工具 -> Maven -> 运行程序将 -Xmx1g 添加到 Maven VM 选项。

没有成功。我还能做什么?

解决方法是在Maven VM options for importer中设置-Xmx1g(或更多)(是的,这是一个单独的选项!)。转到 "Settings/Preferences -> Build Tools -> Maven -> Importing",然后在那里找到选项。

阅读有关 JVM 堆大小的更多信息:(Q) What are the Xms and Xmx parameters when starting JVMs?

只要你想,这个配置就成功了。 "Build process heap size (Mbytes)"

preference->Build,Execution,Deployment->Compiler:Build process heap size (MB)