如何使用 jenkins ant 构建工具中的 `Java Options` 来设置 ANT_OPTS
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/6401002/
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
How to use the `Java Options` in jenkins ant build tool to set ANT_OPTS
提问by Michael
I have a problem with a junit
ant build, i'm getting a java.lang.OutOfMemoryError: PermGen space
error.
我在junit
构建 ant 时遇到问题,出现java.lang.OutOfMemoryError: PermGen space
错误。
I'm trying to set ANT_OPTS
to be ANT_OPTS='-Xmx512m -XX:MaxPermSize=256m'
in the build Java Options
to increase the heap size ant build tool.
我想设置ANT_OPTS
为ANT_OPTS='-Xmx512m -XX:MaxPermSize=256m'
在构建Java Options
以增加堆大小Ant构建工具。
But i get an error each time i run:
但是每次运行时都会出错:
Exception in thread "main" java.lang.NoClassDefFoundError: ANT_OPTS=-Xmx512m -XX:MaxPermSize=256m
Caused by: java.lang.ClassNotFoundException: ANT_OPTS=-Xmx512m -XX:MaxPermSize=256m
at java.net.URLClassLoader.run(URLClassLoader.java:202)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
at java.lang.ClassLoader.loadClass(ClassLoader.java:248)
Could not find the main class: ANT_OPTS=-Xmx512m -XX:MaxPermSize=256m. Program will exit.
A syntax error ?
语法错误?
Thanks.
谢谢。
回答by gouki
Set the JAVA OPTIONS as -Xmx512m -XX:MaxPermSize=256m
only without the ANT_OPTS=
将 JAVA OPTIONS 设置为-Xmx512m -XX:MaxPermSize=256m
only 没有ANT_OPTS=
回答by M.J.
Also, u can add memory option in the build file also, like memoryInitialSize="256m" memoryMaximumSize="512m"
. this will help. as i am using the same, and it caused no problem till now.
此外,您还可以在构建文件中添加内存选项,例如memoryInitialSize="256m" memoryMaximumSize="512m"
. 这会有所帮助。因为我正在使用它,直到现在它没有引起任何问题。