If you're getting the exception during the maven compilation, then there's probably a maven command line arg or pom element you can set to specify heap size. You'd have to look at maven's docs or google for something like how to set heap size in maven.
If you're getting while running your app, after compiling, then maven doesn't have anything to do with it. You can adjust the max heap size by adding a -Xmx arg to the JVM command line. Something like:
Since you're talking about a .war file, I assume this is a web app running under tomcat or jboss or something. The container will most likely have a config file or startup script where you can specify the heap size.
However, it may also be that your app needs more memory than you have available--either due to a design flaw or due to an actual requirement.
Joined: Jan 18, 2013
It worked, I just increased my heap size to 1GB. Now my war file is almost built. Thanks for your quick reply. :-) :-)