Maven 编译时内存溢出问题

Maven 编译时内存溢出问题

1.报错:

有个系统maven编译时报内存溢出错误。

Exception in thread "main"
Exception: java.lang.OutOfMemoryError thrown from the UncaughtExceptionHandler in thread "main"
@ execute XXXX compile Error

2.解决:

没有配置maven的jvm参数,直接在调用maven的应用用户的profile中嵌入rc即可。

echo "MAVEN_OPTS=\"-Xms256m -Xmx512m -XX:MaxPermSize=256m\" ">>~/.glassfishrc
echo "export MAVEN_OPTS" >>~/.glassfishrc
. ~/.glassfishrc

随后把.glassfishrc加入到 .bash_profile中

echo ". ~/.glassfishrc">> ~/.bash_profile