Recently I took up the task of setting up Hybris Commerce development environment and in the process I had to setup Hybris workspace on my eclipse and STS IDE, Hybris comes with a ton of extensions and modules and I ended up having atleast 30 different projects on my workspace to resolve the build errors, with additional projects came the requirement of increased heap memory else STS and Eclipse would either freeze or crash during the ant build phase with an out of memory error.
So here are couple of steps that should be included to support a clean Hybris commerce workspace.
There is a very detailed document on the Hybris WIKI for recommended Eclipse and STS settings so make use of these steps as a addendum to Hybris official document.
64 bit JVMNo matter which IDE you make use of it is important to make sure your system is running a 64 bit version of the Oracle JVM, 32 bit JVM has a upper limit of 2GB RAM , so to break this ceiling we need to make use of 64 bit JVM. you can validate this by running the "java -version" command, the output should be as follows and this indicates that we have a 64 bit version of the JVM.
java version "1.7.0"
Java(TM) SE Runtime Environment (build 1.7.0-b147)
Java HotSpot(TM) 64-Bit Server VM (build 21.0-b17, mixed mode)
64 bit IDE and Java Heap Setting (Eclipse or STS)Make sure you download 64 bit version of Eclipse or STS IDE, once you have extracted and installed the respective IDE go ahead and edit Eclipse.ini or STS.ini file and make changes to increase the max heap size, refer following file as a reference from my toolkit setup.
Java Heap Setting for the ANT TaskThe heap setting defined for the IDE in the previous step is only allocated to the IDE, something that most of us misunderstand here is this heap setting does not automatically apply to the process launched within within the IDE, for instance if we launch ANT build task the heap setting is still capped at 2gb.
To increase the max heap setting within the IDE you have to set the VM arguments for the Ant Build in the Run->External Tools->External Tools Configurations dialog. Click the JRE tab and set the usual -Xmx and -Xms params as needed.
Restart the IDE and perform a ANT build, monitor the heap usage from the Task manager and you should notice that the IDE is crossing the threshold of 2GB limit now.