Some times we may need to provide good amount of heap space to maven to run the build. This may be because you are loading lot of resources like loading temporary db to run the test cases. Or one may like to run the web application using some embedded container like jetty. Here you can find how to set memory options with maven.
If you are facing PermGenSpace problem you should use “-XX:MaxPermSize=1024m” java option. Please note that value depends on needs of your application.
If you are facing OutOfMemory problem you should use “-Xmx1024M” . Again the value depends on your application needs.
How to set these on windows ?
You can create them as system properties with name MAVEN_OPTS and value “-Xmx1024M -XX:MaxPermSize=1024m“.
On Unix based systems like ubuntu :
You can add following two lines to your .profile file in home folder. Change the values according to your need.
You should use single quotes only here. If you use double or no quotes, it will complain. Hope this is useful for you. If there is a better way, please let the world know about 🙂 .