java.lang.OutOfMemoryError: java heap space while building our project either by using maven or ANT just because heap size is not enough to build the project. At this point we just want to increase the heap size used by ANT or MAVEN and this java tip will let you do this:
Open your mvn.sh file and add the following line:
this will allow to specify java heap space based on your project needs.
1. go to C:\apache-maven-2.2.1\bin
2. open your mvn.bat file and add the following line :
next time you run maven commands like mvn clean or mvn install it will use this heap size.
You can also set MAVEN_OPTS in environment variable in window/linux