We have Jenkins running on an ec2 instance. When doing a build, we see the following error:
17:29:39.149 [INFO] [org.gradle.api.Project] OpenJDK 64-Bit Serve
I've sold the same problem. (I have ec2, t2.micro, Ubuntu 14, Jenkins, Tomcat, Maven). By default you don't have swap space. To confirm this:
free -m
Just add some. Try with 1 GB for begin.
sudo fallocate -l 1G /swapfile
sudo chmod 600 /swapfile
sudo mkswap /swapfile
sudo swapon /swapfile
Check again:
free -m
For more details look here