如何摆脱在Gradle中调用ant.wsimport的OutOfMemoryError?
ant.wsimport(keep: true, destdir: destDir, wsdl: wsdl, wsdlLocation: wsdlLocation, package: destPackage, verbose: false, fork: false, xendorsed: true, xnocompile: true)
这是stacktrace:
...
Caused by: java.lang.OutOfMemoryError: PermGen space
at org.gradle.logging.internal.AbstractStyledTextOutput.withStyle(AbstractStyledTextOutput.java:87)
at org.gradle.BuildExceptionReporter.fillInFailureResolution(BuildExceptionReporter.java:191)
at org.gradle.BuildExceptionReporter.formatGenericFailure(BuildExceptionReporter.java:131)
at org.gradle.BuildExceptionReporter.reportBuildFailure(BuildExceptionReporter.java:125)
at org.gradle.BuildExceptionReporter.constructFailureDetails(BuildExceptionReporter.java:113)
at org.gradle.BuildExceptionReporter.renderSingleBuildException(BuildExceptionReporter.java:101)
at org.gradle.BuildExceptionReporter.execute(BuildExceptionReporter.java:72)
at org.gradle.BuildExceptionReporter.buildFinished(BuildExceptionReporter.java:63)
at org.gradle.BuildLogger.buildFinished(BuildLogger.java:76)
at org.gradle.messaging.dispatch.ReflectionDispatch.dispatch(ReflectionDispatch.java:35)
at org.gradle.messaging.dispatch.ReflectionDispatch.dispatch(ReflectionDispatch.java:24)
at org.gradle.listener.DefaultListenerManager$LoggerDispatch.dispatch(DefaultListenerManager.java:174)
at org.gradle.listener.DefaultListenerManager$LoggerDispatch.dispatch(DefaultListenerManager.java:163)
at org.gradle.listener.BroadcastDispatch.dispatch(BroadcastDispatch.java:79)
at org.gradle.listener.BroadcastDispatch.dispatch(BroadcastDispatch.java:31)
at org.gradle.messaging.dispatch.ProxyDispatchAdapter$DispatchingInvocationHandler.invoke(ProxyDispatchAdapter.java:93)
at com.sun.proxy.$Proxy12.buildFinished(Unknown Source)
答案 0 :(得分:0)
似乎ant在Gradle JVM中执行。
因此,控制Gradle JVM的内存设置的最佳方法是通过gradle.properties中的org.gradle.jvmargs = ...。
org.gradle.jvmargs = -XX:MaxPermSize参数= 512M