“java.lang.OutOfMemoryError: PermGen space”在 Maven 构建中
我在构建 Maven 项目时遇到此错误,我增加了 MAVEN_OPTS 但仍然如此,我发现了一些类似的帖子,但它们引用了其他内容。我该如何解决这个问题?
The system is out of resources.
Consult the following stack trace for details.
java.lang.OutOfMemoryError: PermGen space
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClassCond(ClassLoader.java:632)
at java.lang.ClassLoader.defineClass(ClassLoader.java:616)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:141)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:283)
at java.net.URLClassLoader.access$000(URLClassLoader.java:58)
at java.net.URLClassLoader$1.run(URLClassLoader.java:197)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
at org.codehaus.plexus.compiler.javac.IsolatedClassLoader.loadClass(IsolatedClassLoader.java:56)
at com.sun.tools.javac.comp.Annotate.<init>(Annotate.java:52)
at com.sun.tools.javac.comp.Annotate.instance(Annotate.java:36)
at com.sun.tools.javac.jvm.ClassReader.<init>(ClassReader.java:215)
at com.sun.tools.javac.jvm.ClassReader.instance(ClassReader.java:168)
at com.sun.tools.javac.main.JavaCompiler.<init>(JavaCompiler.java:293)
at com.sun.tools.javac.main.JavaCompiler.instance(JavaCompiler.java:72)
at com.sun.tools.javac.main.Main.compile(Main.java:340)
at com.sun.tools.javac.main.Main.compile(Main.java:279)
at com.sun.tools.javac.main.Main.compile(Main.java:270)
at com.sun.tools.javac.Main.compile(Main.java:87)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.codehaus.plexus.compiler.javac.JavacCompiler.compileInProcess(JavacCompiler.java:420)
at org.codehaus.plexus.compiler.javac.JavacCompiler.compile(JavacCompiler.java:141)
at org.apache.maven.plugin.AbstractCompilerMojo.execute(AbstractCompilerMojo.java:493)
at org.apache.maven.plugin.CompilerMojo.execute(CompilerMojo.java:114)
at org.apache.maven.plugin.DefaultPluginManager.executeMojo(DefaultPluginManager.java:490)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java:694)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalWithLifecycle(DefaultLifecycleExecutor.java:556)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoal(DefaultLifecycleExecutor.java:535)
我并不担心如何修复它,而是担心如何在 Maven 生态系统中修复它
I'm getting this error while building Maven project, I increased MAVEN_OPTS but all the same, I found some similar posts but they are refering to something else. How do I fix this?
The system is out of resources.
Consult the following stack trace for details.
java.lang.OutOfMemoryError: PermGen space
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClassCond(ClassLoader.java:632)
at java.lang.ClassLoader.defineClass(ClassLoader.java:616)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:141)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:283)
at java.net.URLClassLoader.access$000(URLClassLoader.java:58)
at java.net.URLClassLoader$1.run(URLClassLoader.java:197)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
at org.codehaus.plexus.compiler.javac.IsolatedClassLoader.loadClass(IsolatedClassLoader.java:56)
at com.sun.tools.javac.comp.Annotate.<init>(Annotate.java:52)
at com.sun.tools.javac.comp.Annotate.instance(Annotate.java:36)
at com.sun.tools.javac.jvm.ClassReader.<init>(ClassReader.java:215)
at com.sun.tools.javac.jvm.ClassReader.instance(ClassReader.java:168)
at com.sun.tools.javac.main.JavaCompiler.<init>(JavaCompiler.java:293)
at com.sun.tools.javac.main.JavaCompiler.instance(JavaCompiler.java:72)
at com.sun.tools.javac.main.Main.compile(Main.java:340)
at com.sun.tools.javac.main.Main.compile(Main.java:279)
at com.sun.tools.javac.main.Main.compile(Main.java:270)
at com.sun.tools.javac.Main.compile(Main.java:87)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.codehaus.plexus.compiler.javac.JavacCompiler.compileInProcess(JavacCompiler.java:420)
at org.codehaus.plexus.compiler.javac.JavacCompiler.compile(JavacCompiler.java:141)
at org.apache.maven.plugin.AbstractCompilerMojo.execute(AbstractCompilerMojo.java:493)
at org.apache.maven.plugin.CompilerMojo.execute(CompilerMojo.java:114)
at org.apache.maven.plugin.DefaultPluginManager.executeMojo(DefaultPluginManager.java:490)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java:694)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalWithLifecycle(DefaultLifecycleExecutor.java:556)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoal(DefaultLifecycleExecutor.java:535)
I'm not as worried about how to fix as to how to fix it in the maven ecosystem
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(7)
当您说增加了
MAVEN_OPTS
时,您增加了哪些值?您是否增加了 MaxPermSize,例如:(或在 Windows 上:)
您还可以指定这些 JVM 选项 分别在每个 Maven 项目中。
When you say you increased
MAVEN_OPTS
, what values did you increase? Did you increase theMaxPermSize
, as in example:(or on Windows:)
You can also specify these JVM options in each maven project separately.
如果您想让 POM 的这一部分用于可重复构建,您可以使用一些插件的 fork 变体(尤其是 编译器:compile和surefire:测试):
If you want to make this part of your POM for a repeatable build, you can use the fork-variant of a few of the plugins (especially compiler:compile and surefire:test):
当然,增加烫发空间的大小。使用
-XX:MaxPermSize=128m
选项。将值设置为适当的值。Increase the size of your perm space, of course. Use the
-XX:MaxPermSize=128m
option. Set the value to something appropriate.当我遇到这个异常时,我通过使用运行配置...面板解决了这个问题,如下图所示。特别是在 JRE 选项卡中,VM 参数是关键
("-Xmx1024m -Xms512m -XX:MaxPermSize =1024m -XX:PermSize=512m" )。
When I encountered this exception, I solved this by using Run Configurations... panel as picture shows below.Especially, at JRE tab, the VM Arguments are the critical
( "-Xmx1024m -Xms512m -XX:MaxPermSize=1024m -XX:PermSize=512m" ).
这个非常烦人的错误所以我做了什么:
在 Windows 下:
然后填写
然后重新启动控制台并再次运行 Maven 构建。不再有 Maven 空间/perm 大小问题。
This very annoying error so what I did:
Under Windows:
then fill
Then restart the console and run the maven build again. No more Maven space/perm size problems.
当您尝试使用 git mvn clean install 构建战争时,我找到了 git bash 命令的解决方案
Maven 构建错误出现“java.lang.OutOfMemoryError: PermGen space”
I have found a solution of git bash command when you try to build war using git mvn clean install for
“java.lang.OutOfMemoryError: PermGen space” in Maven build error come
当永久生成堆已满并且我们中的一些人使用命令提示符在 Windows 中构建 Maven 项目时,我们会遇到此错误。由于我们需要增加堆大小,因此我们可以设置环境变量 @ControlPanel/System 和 Security/System,然后单击更改设置并选择高级并设置环境变量如下
We face this error when permanent generation heap is full and some of us we use command prompt to build our maven project in windows. since we need to increase heap size, we could set our environment variable @ControlPanel/System and Security/System and there you click on Change setting and select Advanced and set Environment variable as below