在eclipse中执行maven build(clean tomcat:redeploy -Dmaven.test.skip=true)后总是提示下面的错误:
[INFO]
[INFO] <<< tomcat-maven-plugin:1.1:redeploy (default-cli) @ yibao-upp <<<
[INFO]
[INFO] --- tomcat-maven-plugin:1.1:redeploy (default-cli) @ yibao-upp ---
[INFO] Deploying war to http://localhost:8080/upp
[ERROR] Java heap space -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/OutOfMemoryError
后来得知当Maven项目很大,或者你运行诸如 mvn site 这样的命令的时候,maven运行需要很大的内存,在默认配置下,就可能遇到java的堆溢出
所以在m2eclipse执行maven build时需要简单的设置内存大小,操作如下:
项目上右击 -> Run As -> Run Configurations -> Maven Build 上右击 -> New
maven运行配置对话框,选择第二个TAB: JRE,然后在VM arguments中输入配置如:-Xms128m -Xmx512m