"java.lang.OutOfMemoryError: PermGen space " w Maven build [duplikat]

To pytanie ma już odpowiedź tutaj:

Dostaję ten błąd podczas budowania projektu Maven, zwiększyłem MAVEN_OPTS, ale wszystko to samo, znalazłem kilka podobnych postów, ale odnoszą się one do czegoś innego. Jak to naprawić?

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)
Author: Mark Rotteveel, 2010-06-23

7 answers

Kiedy mówisz, że zwiększyłeś MAVEN_OPTS, jakie wartości zwiększyłeś? Czy zwiększyłeś MaxPermSize, jak w przykładzie:

export MAVEN_OPTS="-Xmx512m -XX:MaxPermSize=128m"

(lub na Windows:)

set MAVEN_OPTS=-Xmx512m -XX:MaxPermSize=128m
 303
Author: Arun R,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/doraprojects.net/template/agent.layouts/content.php on line 54
2015-04-23 16:01:10

Jeśli chcesz, aby ta część POM była powtarzalna, możesz użyć fork-variant kilku wtyczek (szczególnie compiler: compile i surefire: test):

<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-compiler-plugin</artifactId>
    <version>3.2</version>
    <configuration>
      <fork>true</fork>
      <meminitial>128m</meminitial>
      <maxmem>1024m</maxmem>
      <compilerArgs>
        <arg>-XX:MaxPermSize=256m</arg>
      </compilerArgs>
    </configuration>
  </plugin>

<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-surefire-plugin</artifactId>
    <version>2.18</version>
    <configuration>
        <forkCount>1</forkCount>
        <argLine>-Xmx1024m -XX:MaxPermSize=256m</argLine>
    </configuration>
</plugin>
 23
Author: eckes,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/doraprojects.net/template/agent.layouts/content.php on line 54
2015-05-19 14:33:02

Oczywiście Zwiększ rozmiar swojej przestrzeni trwałej. Użyj opcji -XX:MaxPermSize=128m. Ustaw wartość na coś odpowiedniego.

 16
Author: duffymo,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/doraprojects.net/template/agent.layouts/content.php on line 54
2010-06-23 11:31:50

Ten bardzo irytujący błąd więc co zrobiłem: Pod Windows:

Edit system environment variables - > Edit Variables -> New

Następnie wypełnij

MAVEN_OPTS
-Xms512m -Xmx2048m -XX:MaxPermSize=512m

Tutaj wpisz opis obrazka

Następnie uruchom ponownie konsolę i uruchom maven build ponownie. Nigdy więcej problemów z przestrzenią Maven / rozmiarem perm.

 1
Author: Xelian,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/doraprojects.net/template/agent.layouts/content.php on line 54
2017-06-26 11:29:21

Znalazłem rozwiązanie polecenia Git bash przy próbie budowania wojny używając git mvn clean install dla "java.lang.OutOfMemoryError: PermGen space " w Maven build error come

use below command first 

$ export MAVEN_OPTS="-Xmx512m -Xss32m"

then use your mvn command to clean install /build war file

$ mvn clean install

NOTE: you don't need -XX:MaxPermSize argument in MAVEN_OPTS when your are using jdk1.8
Java HotSpot(TM) Client VM warning: ignoring option MaxPermSize=XXXm; support was removed in 8.0
 0
Author: mkumar0304,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/doraprojects.net/template/agent.layouts/content.php on line 54
2017-01-30 12:08:08

Kiedy napotkałem ten wyjątek, rozwiązałem to za pomocą Run Configurations... panel jak pokazuje obrazek poniżej.Szczególnie w JRE tab argumenty VM są krytycznym
( "-xmx1024m-Xms512m-XX:MaxPermSize=1024M-XX:PermSize=512M").

Tutaj wpisz opis obrazka

 0
Author: ÖMER TAŞCI,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/doraprojects.net/template/agent.layouts/content.php on line 54
2017-03-09 13:40:58

Spotykamy się z tym błędem, gdy permanent generation heap jest pełny i niektórzy z nas używają wiersza polecenia, aby zbudować nasz projekt maven w windows. ponieważ musimy zwiększyć rozmiar sterty, możemy ustawić naszą zmienną środowiskową @ ControlPanel / System i Security / System i tam klikamy na Zmień ustawienie i wybierz Zaawansowane i ustaw zmienną środowiskową jak poniżej

  • Nazwa zmiennej: MAVEN_OPTS
  • zmienna-wartość: - XX: MaxPermSize=128M
 0
Author: Ranjit,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/doraprojects.net/template/agent.layouts/content.php on line 54
2017-04-12 12:12:19