Travis Maven build exits with OutOfMemoryException

I have a maven build running on Travis (dockerized) which builds just fine on my command line. Since a couple of days I get java.lang.OutOfMemoryError: GC overhead limit exceeded during the test cases. This happens always during the AspectJ test cases.

The output of the last build is

I did not made any intensive changes. And I did not touch the AspectJ part of the application. I tested various things with JAVA_OPTS, MAVEN_OPTS and even passing more RAM in the pom.xml for tycho-surefire-plugin. Nothing helped.

How can I get rid of the error and make all my tests run again? I think they changed anything on Travis' side that is causing the error.


GC overhead limit exceeded means that your JVM is spending the most of the time in garbage collection which indicates some serious problems. This could not be fixed through JAVA_OPTS or MAVEN_OPTS because this is a programming (code) problem. You can try to add


but thats not recommended. For further information see this and that.

Try increasing your stack size, e.g. by ulimit -s 82768 and re-try. To check the limits, run ulimit -a or free -m for free memory.

The solution is stated here and references an issue how Travis CI provides MAVEN_OPTS. So if you are not fine with provided MAVEN_OPTS values you are not able to build in an containerized environment, because there is no sudo available.

  - sudo rm /etc/mavenrc
  - export M2_HOME=/usr/local/maven
  - export MAVEN_OPTS="-Dmaven.repo.local=$HOME/.m2/repository -Xms1024m -Xmx3072m -XX:PermSize=512m"

This pull request will make your changes to MAVEN_OPTS work. Thus, you can change MAVEN_OPTS without having to use the workaround above and therefore can use containerized builds with Maven.

Need Your Help

Wiring package exceptions in Fuse/Karaf

osgi apache-camel fuseesb

In many projects, I have came across this exception. What could be the reason for this exception ?

Changed my package name and now my google maps show as a white screen, how do I fix this?

android google-maps-api-2

I accidentally made my package com.example.appname so when I tried to publish it, it wouldn't go through. I changed the package name to myname.app1.appname and everything works the same except my m...