当我运行mvn install时,出现错误

时间:2015-09-15 02:56:15

标签: java maven

系统资源不足。     有关详细信息,请参阅以下堆栈追踪。     java.lang.OutOfMemoryError:Java堆空间         在java.util.jar.Manifest $ FastInputStream。(Manifest.java:315)         在java.util.jar.Manifest $ FastInputStream。(Manifest.java:310)         在java.util.jar.Manifest.read(Manifest.java:178)         在java.util.jar.Manifest。(Manifest.java:52)         在java.util.jar.JarFile.getManifestFromReference(JarFile.java:165)         在java.util.jar.JarFile.getManifest(JarFile.java:146)         at sun.misc.URLClassPath $ JarLoader $ 2.getManifest(URLClassPath.java:693)         at java.net.URLClassLoader.defineClass(URLClassLoader.java:221)         at java.net.URLClassLoader.access $ 000(URLClassLoader.java:56)         在java.net.URLClassLoader $ 1.run(URLClassLoader.java:195)         at java.security.AccessController.doPrivileged(Native Method)         在java.net.URLClassLoader.findClass(URLClassLoader.java:188)         at java.lang.ClassLoader.loadClass(ClassLoader.java:307)         at java.lang.ClassLoader.loadClass(ClassLoader.java:252)         at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:320)         在com.sun.tools.javac.util.JCDiagnostic.fragment(JCDiagnostic.java:158)         at com.sun.tools.javac.comp.Resolve.absentKindName(Resolve.java:1486)         at com.sun.tools.javac.comp.Resolve $ ResolveError.report(Resolve.java:1581)         在com.sun.tools.javac.comp.Resolve.access(Resolve.java:1079)         at com.sun.tools.javac.comp.Resolve.resolveQualifiedMethod(Resolve.java:1214)         at com.sun.tools.javac.comp.Annotate.enterAnnotation(Annotate.java:156)         at com.sun.tools.javac.comp.MemberEnter.enterAnnotations(MemberEnter.java:743)         at com.sun.tools.javac.comp.MemberEnter.access $ 300(MemberEnter.java:42)         at com.sun.tools.javac.comp.MemberEnter $ 5.enterAnnotation(MemberEnter.java:711)         在com.sun.tools.javac.comp.Annotate.flush(Annotate.java:95)         at com.sun.tools.javac.comp.Annotate.enterDone(Annotate.java:87)         在com.sun.tools.javac.comp.Enter.complete(Enter.java:472)         在com.sun.tools.javac.comp.Enter.main(Enter.java:429)         at com.sun.tools.javac.main.JavaCompiler.enterTrees(JavaCompiler.java:819)         at com.sun.tools.javac.main.JavaCompiler.compile(JavaCompiler.java:727)         在com.sun.tools.javac.main.Main.compile(Main.java:353)         在com.sun.tools.javac.main.Main.compile(Main.java:279)

[INFO] 1 error
[INFO] -------------------------------------------------------------
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 16.927s
[INFO] Finished at: Tue Sep 15 10:28:14 CST 2015
[INFO] Final Memory: 21M/63M
[INFO] ------------------------------------------------------------------------
[WARNING] The requested profile "Maven" could not be activated because it does not exist.
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:2.5.1:compile (default-compile) on project pmcs: Compilation failure
[ERROR] Failure executing javac, but could not parse the error:

1 个答案:

答案 0 :(得分:0)

看起来512mb还不够。增加堆内存。例如:

MAVEN_OPTS=-Xms256m -Xmx1024m

如果不起作用,请增加更多。

MAVEN_OPTS=-Xms256m -Xmx2048m

<强>参考文献:

Setting environment variables in Linux using Bash

Setting Java heap space under Maven 2 on Windows

Maven heap space