Maven packaging reports java.lang.OutOfMemoryError

Recently, I encountered a java.lang.OutOfMemoryError when packaging a project with Maven. The error is as follows


1. Check the initial startup memory of eclipse. There is a file eclipse.ini in the eclipse installation directory. Open the modified file and add the red part below. . Mine is 4G memory, if you have 2G memory,

then modify it to 256 and 512

-vmargs
-Dosgi.requiredJavaVersion=1.6
-Xms512m
-Xmx1024m


2. If method 1 can't work, then modify the mvn under bin in the maven installation directory. bat file

@REM set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000
set MAVEN_OPTS= -Xms128m -Xmx512m



3. If method 2 can't work, then find your project, right click run as -> run configuration->maven build right click->new->JRE->VM arguments fill

in -Xms128m -Xmx512m

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326103548&siteId=291194637