Specifying jvm arguments in ant tasks

久未见 提交于 2019-12-02 12:35:30

问题


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..

  <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

回答1:


Use multiple <jvmarg> elements:

<junit printsummary="true" fork="yes" haltonfailure="false" failureproperty="junitsFailed" errorProperty="junitsFailed">
    <jvmarg value="-Xmx1024m"/>
    <jvmarg value="-Duser.timezone=GMT0"/>
</junit>



回答2:


You can set ANT_OPTS parameters. For example in 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):

<junit maxmemory="1024m" ...


来源:https://stackoverflow.com/questions/25039864/specifying-jvm-arguments-in-ant-tasks

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!