We are facing langOutOfMemory error, when we run an ant script, basically this script runs a lot tests. One solution is to increase heap size using ANT_OPTS variable in environment. But the problem here is I want to increase heap size via ant script itself.
I have tried couple of ways, but neither helped:
<target name="test1">
<exec executable="ant" dir="${TEST}">
<env key="ANT_OPTS" value="-Xmx2048m"/>
</exec>
</target>
<target name="test1" dir="{TEST}">
<exec executable="sh">
<arg line="ant"/>
<env key="ANT_OPTS" value="-Xmx2048m"/>
</exec>
</target>
Please help on this.
Thanks,
Ashok
It looks like you are trying to run ant within ant using the exec. This is pretty convoluted. As document exec is meant to run system commands.
Assuming you are running unit tests written in junit using ant junit task, you can use the
maxmemoryparameter to specify the memory to be used. You should also be settingforkto true.If this is not the case, please edit the question with the relevant portion of the ant script.