Setting up environment variable in ant script
I am using ant for building my projects, This project needs more memory then default JVM size, So I have added following line of code in the build.xml
file.
<!-- setting up this value as project need this much memory to compile.-->
<property environment="env" />
<property name="env.ANT_OPTS" value="-Xms1024m -Xmx204888m" />
But above line of code does not seems to have any effect as I am still getting the heap size problem. So I have decided to use a batch
script for launching the build. The line of code in the given batch file is below
set ANT_OPTS=-Xms512m -Xmx778m
ant -f agora-build.xml
Th开发者_Go百科is batch script successfully launch and executes the ant script. But this is not what I am looking for. Is there a way exists, so that I can setup this argument in the ant script itself?
What should i do?
Thanks, VSD
If you set the option in the build script, the JVM is already up and configured; the only way to set JVM-level options from within a build file is to have Ant spawn another JVM (using the java
task as a launcher, or the ant
task).
You can also set ANT_OPTS
as an environment variable; that will affect all Ant builds you run and pass the provided options to the JVM that Ant runs in.
If you are running the Ant script in Eclipse
Right Click -> Run As -> External Tools Configuration
(Add the build if it isn't there already)
Go to the JRE tab and add the Xms and Xmx arguments to the VM arguments section.
*edit: "-Xmx204888m" I hope 2 of those 8's are typo's
精彩评论