运行 Apache Sling 的 maven 构建时出现以下错误,即使使用推荐的堆大小:
main:
[echo] **************** WARNING (SLING-443/SLING-1782) ******************************
[echo] On most platforms, you'll get OutOfMemoryErrors when building unless you set
[echo] on 32bit platforms: MAVEN_OPTS="-Xmx256M -XX:MaxPermSize=256M", see SLING-443
[echo] on 64bit platforms: MAVEN_OPTS="-Xmx512M -XX:MaxPermSize=512M", see SLING-1782
[echo] ******************************************************************************
[INFO] Executed tasks
[INFO]
[INFO] --- maven-resources-plugin:2.4.3:testResources (default-testResources) @ sling-launchpad-webapp-archetype ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory /Users/thomasf/slingDownload/sling/maven/archetypes/launchpad-webapp/src/test/resources
[INFO] Copying 3 resources
[INFO]
[INFO] --- animal-sniffer-maven-plugin:1.7:check (default) @ sling-launchpad-webapp-archetype ---
[INFO] Checking unresolved references to org.codehaus.mojo.signature:java15:1.0
[ERROR] Java heap space -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/OutOfMemoryError
果然我的堆大小和他们在项目主页上推荐的一样:
echo $MAVEN_OPTS
-Xmx512M -XX:MaxPermSize=512m
我怀疑原因是 maven 正在分叉,并且子进程中的 jvm 没有相同的堆大小 - 但是我无法从控制台输出中识别出哪个插件正在分叉。
任何想法表示赞赏!谢谢