Jenkins构建Maven项目,报内存不足错误

在一个内存1G的虚拟机上,Jenkins构建Maven项目正常,在内存64G的服务器上反而报出了内存不足Cannot allocate memory的错误。

今天在服务器上用Jenkins构建Maven项目,一直失败,进入构建控制台查看发现提示内存不足

错误代码如下

Established TCP socket on 27423
[geoSign] $ /usr/local/java/jdk1.8.0_211/bin/java -cp /var/lib/jenkins/plugins/maven-plugin/WEB-INF/lib/maven35-agent-1.13.jar:/usr/local/maven/apache-maven-3.6.1/boot/plexus-classworlds-2.6.0.jar:/usr/local/maven/apache-maven-3.6.1/conf/logging jenkins.maven3.agent.Maven35Main /usr/local/maven/apache-maven-3.6.1 /var/cache/jenkins/war/WEB-INF/lib/remoting-3.29.jar /var/lib/jenkins/plugins/maven-plugin/WEB-INF/lib/maven35-interceptor-1.13.jar /var/lib/jenkins/plugins/maven-plugin/WEB-INF/lib/maven3-interceptor-commons-1.13.jar 27423
Java HotSpot(TM) 64-Bit Server VM warning: INFO: os::commit_memory(0x00007f6118ac0000, 525598720, 0) failed; error='Cannot allocate memory' (errno=12)
#
# There is insufficient memory for the Java Runtime Environment to continue.
# Native memory allocation (mmap) failed to map 525598720 bytes for committing reserved memory.
# An error report file with more information is saved as:
# /var/lib/jenkins/workspace/geoSign/hs_err_pid10507.log
ERROR: Failed to launch Maven. Exit code = 1
Finished: FAILURE

最后发现,修改Jenkins 的jvm参数就可以实现

vi /etc/sysconfig/jenkins

Jenkins构建Maven项目,报内存不足错误_第1张图片

然后重启Jenkins就可以正常构建了

你可能感兴趣的:(Jenkins,centos,memory,Jenkins自动化测试与部署)