How to use the `Java Options` in jenkins ant build

2019-02-21 17:53发布

I have a problem with a junit ant build, i'm getting a java.lang.OutOfMemoryError: PermGen space error.

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. enter image description here

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

2条回答
甜甜的少女心
2楼-- · 2019-02-21 18:44

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.

查看更多
ゆ 、 Hurt°
3楼-- · 2019-02-21 18:47

Set the JAVA OPTIONS as -Xmx512m -XX:MaxPermSize=256m only without the ANT_OPTS=

查看更多
登录 后发表回答