java 在 ant 任务中指定 jvm 参数
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/25039864/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Specifying jvm arguments in ant tasks
提问by user3875672
I am specifying jvm arguments since i was getting out of heap space exception so just to avoid that i was specifying the below parameters in my ant target that is as shown below..
我正在指定 jvm 参数,因为我已经超出了堆空间异常,所以只是为了避免我在我的 ant 目标中指定以下参数,如下所示..
<junit
printsummary="true"
fork="yes"
haltonfailure="false"
failureproperty="junitsFailed"
errorProperty="junitsFailed"
>
<jvmarg value=" -Xmx1024m -Duser.timezone=GMT0"/>
</junit>
but below i am getting the below exception ..
但在下面我得到以下异常..
that is the invalid parameters are specified
回答by Chad Nouis
Use multiple <jvmarg>
elements:
使用多个<jvmarg>
元素:
<junit printsummary="true" fork="yes" haltonfailure="false" failureproperty="junitsFailed" errorProperty="junitsFailed">
<jvmarg value="-Xmx1024m"/>
<jvmarg value="-Duser.timezone=GMT0"/>
</junit>
回答by Aliaksei
You can set ANT_OPTS parameters. For example in Windows
您可以设置 ANT_OPTS 参数。例如在 Windows 中
SET ANT_OPTS=-Xmx1024m -XX:MaxPermSize=256m
or just use maxmemory
attribute of junit
ant task (http://ant.apache.org/manual/Tasks/junit.html):
或者只使用ant 任务的maxmemory
属性junit
(http://ant.apache.org/manual/Tasks/junit.html):
<junit maxmemory="1024m" ...