Environment:
IntelliJ IDEA 2016.3.1 Build #IU-163.9166.29, built on December 9, 2016 JRE: 1.8.0_112-release-408-b2 x86_64 JVM: OpenJDK 64-Bit Server VM by JetBrains s.r.o
Mac OS 10.12.2
I have the Ant Support plugin installed in IntelliJ and am executing a build.xml script (see below for build.xml contents). I am getting the following error when executing the script.
java.lang.OutOfMemoryError: Java heap space.
I have googled for an hour or so and have tried adding memory parameters to shell/batch script and increasing IntelliJ compiler heap space to no avail. Just to be clear I'm using the Ant Build tool window in IntelliJ to start the execution of the Ant task(s). What setting(s) am I missing to adjust the available memory to the Java compiler?
<project name="Ant Deploy" default="deployProj" basedir="." xmlns:sf="antlib:com.salesforce">
<property file="build.properties"/>
<property environment="env"/>
<!-- Test out deploy and retrieve verbs for package 'mypkg' -->
<target name="deployProj">
<taskdef resource="com/salesforce/antlib.xml" uri="antlib:com.salesforce">
<classpath>
<pathelement location="ant-salesforce.jar" />
</classpath>
</taskdef>
<!-- Upload the contents of the "dst" package -->
<sf:deploy username="${sf.username}" password="${sf.password}" serverurl="${sf.serverurl}" maxPoll="500" pollWaitMillis="150000"
deployRoot="deployRootDir" rollbackOnError="false"/>
</target>
</project>
Much to my surprise the solution was very simple and there are two ways I discovered to access the parameter I needed to change.
Within the Ant Build tool window of IntelliJ
Click the Properties icon (the one with checkboxes with one checked). See this screenshot from the Ant Build tool window. In this screenshot it is the 7th icon (counting left to right).
OR
Once in the Build File Properties popup dialog you should see the setting Maximum heap size (Mb). In my case it was defaulted to 128 Mb. Increase the value of this setting as you see fit (512 Mb worked for my scenario). Press OK and attempt to run the Ant task(s) again. The java.lang.OutOfMemoryError: Java heap space.
error should go away given you have increased the Maximum heap size (Mb) enough.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With