I have a java project, which I build with Maven.
My maven version is 3.1.1 my java version is 1.7.0_25
When I run mvn clean install
, I got the following error:
The system is out of resources.
Consult the following stack trace for details.
java.lang.OutOfMemoryError: Java heap space
at com.sun.tools.javac.file.ZipFileIndex$ZipDirectory.findCENRecord(ZipFileIndex.java:552)
at com.sun.tools.javac.file.ZipFileIndex$ZipDirectory.<init>(ZipFileIndex.java:497)
at com.sun.tools.javac.file.ZipFileIndex.checkIndex(ZipFileIndex.java:191)
at com.sun.tools.javac.file.ZipFileIndex.<init>(ZipFileIndex.java:137)
at com.sun.tools.javac.file.ZipFileIndexCache.getZipFileIndex(ZipFileIndexCache.java:100)
at com.sun.tools.javac.file.JavacFileManager.openArchive(JavacFileManager.java:559)
at com.sun.tools.javac.file.JavacFileManager.openArchive(JavacFileManager.java:482)
at com.sun.tools.javac.file.JavacFileManager.listContainer(JavacFileManager.java:368)
at com.sun.tools.javac.file.JavacFileManager.list(JavacFileManager.java:644)
at com.sun.tools.javac.jvm.ClassReader.fillIn(ClassReader.java:2446)
at com.sun.tools.javac.jvm.ClassReader.complete(ClassReader.java:2143)
at com.sun.tools.javac.code.Symbol.complete(Symbol.java:421)
at com.sun.tools.javac.comp.Enter.visitTopLevel(Enter.java:298)
at com.sun.tools.javac.tree.JCTree$JCCompilationUnit.accept(JCTree.java:459)
at com.sun.tools.javac.comp.Enter.classEnter(Enter.java:258)
at com.sun.tools.javac.comp.Enter.classEnter(Enter.java:272)
at com.sun.tools.javac.comp.Enter.complete(Enter.java:484)
at com.sun.tools.javac.comp.Enter.main(Enter.java:469)
at com.sun.tools.javac.main.JavaCompiler.enterTrees(JavaCompiler.java:929)
at com.sun.tools.javac.main.JavaCompiler.compile(JavaCompiler.java:824)
at com.sun.tools.javac.main.Main.compile(Main.java:439)
at com.sun.tools.javac.api.JavacTaskImpl.call(JavacTaskImpl.java:132)
at org.codehaus.plexus.compiler.javac.JavaxToolsCompiler.compileInProcess(JavaxToolsCompiler.java:125)
at org.codehaus.plexus.compiler.javac.JavacCompiler.performCompile(JavacCompiler.java:169)
at org.apache.maven.plugin.compiler.AbstractCompilerMojo.execute(AbstractCompilerMojo.java:823)
at org.apache.maven.plugin.compiler.CompilerMojo.execute(CompilerMojo.java:129)
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:106)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:208)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:84)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:59)
How to solve it? I googled and see many answers which configures project's pom to solve the problem. But is there away to configure it globally? If so, how to do so?
(I remember there is a way to configure this in maven's global settings xml file, but I just can't recall the exact file & how to configure there. This is my actual question I really need an answer, I am not looking for a way to only configure in each project's pom.xml, but a maven global configuration)