背景
今天一大早来到公司启动项目时就报错了 :maven-resources-production:ecgnetwork-server: java.lang.OutOfMemoryError: Java heap space。编译时内存空间不足,在百度上找了一下解决方案
- 添加mavn插件修改编辑器最大内存
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.1</version>
<configuration>
<fork>true</fork>
<meminitial>512m</meminitial>
<!-- 设置最大内存 -->
<maxmem>4096m</maxmem>
</configuration>
</plugin>
</plugins>
</build>
- 在idea中修改最大内存(File | Settings | Build, Execution, Deployment | Build Tools | Maven | Importing)
- 再修改线程数(File | Settings | Build, Execution, Deployment | Compiler)
- 再启动…正常了~!