|Table of Contents|
Builds running out of memory?
As your project grows, and you use new tools to either build or analyze your code, you will inevitably exceed the memory settings which your JVM provides by default. This is especially true on 64 bit JVM's since they double the size of the reference pointer. This page aims to show you how to increase the memory available to your build process.
Heap or Permgen?
There are two OutOfMemoryErrors which people usually encounter. The first is related to heap space:
The second is related to PermGen:
Various Build Tools
This section demonstrates how to set these JVM switches depending on the kind of build you are running.
Maven2/3 Project Type
If you are using a Maven2/3 project type, you can set the
You can adjust the MAVEN_OPTS individually per job by navigating to the job, then clicking "configure" on the job menu, then under the "Build" section clicking advanced, then specifying a setting for the MAVEN_OPTS option.
Freestyle projects with Maven Build Steps
If you have a Freestyle project with a "Invoke Top Level Maven Targets" build step, you can add the appropriate JVM switches for a given build by clicking the Advanced button on the build step and entering the JVM arguments in the JVM Options field.
Alternatively, you can affect all free style Maven build steps by adding a MAVEN_OPTS global environment variable in the Jenkins global configuration. To do this, click Manage Jenkins, then Configure System. In the Global properties section, click the Environment Variables checkbox, then add a new environment variable called MAVEN_OPTS with the value set appropriately:
Gradle build steps
You can set the
Ant build steps
For Ant steps, there is no global environment variable; you must set the Ant options in each individual build step. In the configuration for the build, find the Invoke Ant step, click Advanced, and enter the options into the Java Options box.