Set Maven Memory Limits
Jakob Jenkov |
You may need to adjust the Maven memory limits if you are building a large Maven project, or if your are running Maven on a computer or VM with little amount of memory. From Maven 3.3 and forward you can set the memory limits in a file called jvm.config located in the .mvn directory inside your project directory. This enables you to set the Maven memory limits on a per-project basis, rather than for all projects as was the case with the previous environment variable configuration style.
Project Directory Structure
To be able to set the Maven memory limits you will need a directory structure for your project like the following structure:
- myproject
- .mvn
- jvm.config
- .mvn
jvm.config Contents
Inside the jvm.config file you need the following settings to be able to control the memory limits of Maven during a Maven build:
-Xmx2048m -Xms1024m
Obviously you will have adjust the values in these settings to match the maximum and minimum memory settings to fit your needs.
Tweet | |
Jakob Jenkov |