I have a Jenkins running that shall build a Java project of which I know that some of the Unit-Tests are quite RAM greedy.
I think I still got something wrong with the Jenkins memory-assignments, some of my Jobs are failing with an OOM exception, more specifically Java Heap Space.
I gave Jenkins itself 2GB by editing the /etc/default/jenkins
file. To ensure that the JUnit-Tests also have enough RAM I assigned as Global MAVEN_OPTS
the value -Dmaven.surefire.heap=12g
via the Jenkins GUI.
This should be enough to run all tests. But the build is still failing. I am new to Jenkins, so I would appreciate a pointer what could be the issue here.
One method of reducing the heap impact of running your tests is to run all of your jUnit tests in seperate JVMs. This does have a trade off with speed however, it will mean each individual test class take longer. The time for each method will remain the same, just additional time to setup for each test class.
You can change this setting in the maven surefire plugin, add these lines to its setup in your pom:
<configuration>
<forkCount>1</forkCount>
<reuseForks>false</reuseForks>
</configuration>
More information on this topic can be found on the maven page for forking and parallel test execution .
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.