简体   繁体   English

如何在JENKINS中处理线程“ main”中的“ [ERROR]异常”(主要是java.lang.OutOfMemoryError:Java堆空间)?

[英]How to handle “[ERROR] Exception in thread ”main“ java.lang.OutOfMemoryError: Java heap space” in JENKINS?

I have been building GWT war file on Jenkins. 我一直在詹金斯建立GWT战争档案。 In a specific "job" I have encountered an error which says [ERROR] Exception in thread "main" java.lang.OutOfMemoryError: Java heap space . 在一个特定的“作业”中,我遇到了一个错误,该错误指示[ERROR] Exception in thread "main" java.lang.OutOfMemoryError: Java heap space As a solution, I have included an environment variable "MAVEN_OPTS" with a value of -Xms512m -Xmx1024m -XX:MaxPermSize=512m . 作为解决方案,我包括了一个环境变量“ MAVEN_OPTS”,其值为-Xms512m -Xmx1024m -XX:MaxPermSize=512m FYI, I have also tried 'echo' command prompt for MAVEN_OPTS and it displays the same value as I had given in the environment variable. 仅供参考,我还尝试了MAVEN_OPTS的“ echo”命令提示符,它显示的值与环境变量中给出的值相同。

MAVEN COMPILER PLUGIN in pom.xml : pom.xml中的MAVEN COMPILER PLUGIN:

<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-compiler-plugin</artifactId>
    <version>2.3.2</version>
    <configuration>
    <source>1.7</source>
    <target>1.7</target>
    <showDeprecation>true</showDeprecation>
    <showWarnings>true</showWarnings>
    <executable>${env.JAVA_HOME}/bin/javac</executable>
    <fork>true</fork>
    <verbose>true</verbose>
    <encoding>UTF-8</encoding>
    </configuration>
</plugin>

**Full error: ** **完整错误:**

[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 13:51.518s
[INFO] Finished at: Thu Jan 29 13:06:25 IST 2015
[INFO] Final Memory: 17M/989M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.codehaus.mojo:gwt-maven-              plugin:2.4.0:compile
(default) on project dpgwtwebapplication: Command [[
[ERROR] C:\Program Files\Java\jdk1.7.0_04\jre\bin\java -Xmx512m -classpath    "C:\U

Also in mvn.bat file, the value of MAVEN_OPTS is displaying as -Xmx512m as you can notice in last of Full error. 同样在mvn.bat文件中,MAVEN_OPTS的值也显示为-Xmx512m正如您在Full错误的最后一个中可以注意到的那样。

I guess the problem is not to less memory for the java compile process but for the gwt-compiler. 我想问题不在于为Java编译过程减少内存,而是为gwt-compiler减少内存。 Increase the memory significantly here: org.codehaus.mojo gwt-maven-plugin ... 在此处显着增加内存:org.codehaus.mojo gwt-maven-plugin ...

See: Codehaus.org gwt plugin usage 请参阅: Codehaus.org gwt插件用法

The problem is that you are forking the compiler as configured in the maven-compiler-plugin . 问题是您要按maven-compiler-plugin中的配置分叉编译 You should define the parameters for memory like the following: 您应该像以下那样定义内存参数:

<project>
  [...]
  <build>
    [...]
    <plugins>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-compiler-plugin</artifactId>
        <version>3.2</version>
        <configuration>
          <fork>true</fork>
          <meminitial>128m</meminitial>
          <maxmem>512m</maxmem>
        </configuration>
      </plugin>
    </plugins>
    [...]
  </build>
  [...]
</project>

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 线程“main”中的异常 java.lang.OutOfMemoryError: Java heap space - Exception in thread “main” java.lang.OutOfMemoryError: Java heap space 2线程“ main”中的异常java.lang.OutOfMemoryError:Java堆空间 - 2 Exception in thread “main” java.lang.OutOfMemoryError: Java heap space 线程“main”中的异常java.lang.OutOfMemoryError:Java堆空间 - Exception in thread “main” java.lang.OutOfMemoryError: Java heap space 错误:线程“ main”中的异常java.lang.OutOfMemoryError:Java堆空间 - Error:Exception in thread “main” java.lang.OutOfMemoryError: Java heap space 如何摆脱-“线程“ AWT-EventQueue-0”中的异常java.lang.OutOfMemoryError:Java堆空间”错误? - How to get rid of - “Exception in thread ”AWT-EventQueue-0“ java.lang.OutOfMemoryError: Java heap space” error? 线程“主”java.lang.OutOfMemoryError 中的异常:org.apache.commons.lang3.ArrayUtils 处的 Java 堆空间 - Exception in thread "main" java.lang.OutOfMemoryError: Java heap space at org.apache.commons.lang3.ArrayUtils 线程“ main”中的异常java.lang.OutOfMemoryError:尝试验证数百万个数据时的Java堆空间 - Exception in thread “main” java.lang.OutOfMemoryError: Java heap space while trying to Verify Millions of data 线程“main”中的异常 java.lang.OutOfMemoryError:oracle.jdbc.driver.OracleSql 中的 Java 堆空间。<init> - Exception in thread "main" java.lang.OutOfMemoryError: Java heap space at oracle.jdbc.driver.OracleSql.<init> 斯坦福 CoreNLP - 线程“main”中的异常 java.lang.OutOfMemoryError: Java heap space - Stanford CoreNLP - Exception in thread "main" java.lang.OutOfMemoryError: Java heap space 线程“ main”中的异常java.lang.OutOfMemoryError:Eclipse中的Java堆空间 - Exception in thread “main” java.lang.OutOfMemoryError: Java heap space in eclipse
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM