【问题标题】:Fixing maven Java heap space error修复 maven Java 堆空间错误
【发布时间】:2013-08-17 17:14:00
【问题描述】:

长话短说,我有一个 maven 项目,如果我使用它运行良好:

export MAVEN_OPTS=-Xmx1024m

但没有它我得到:

[INFO] --- maven-compiler-plugin:3.1:compile (default-compile) @ project ---

...

An annotation processor threw an uncaught exception.
Consult the following stack trace for details.
java.lang.OutOfMemoryError: Java heap space

现在我想将该配置移动到 pom 文件中。 我尝试了两种可能性:

<plugin>
    <artifactId>maven-compiler-plugin</artifactId>
    <version>3.1</version>
    <configuration>
        <meminitial>512m</meminitial>
        <maxmem>2048m</maxmem>
        <source>1.6</source>
        <target>1.6</target>
    </configuration>
</plugin>

...

<plugin>
    <artifactId>maven-compiler-plugin</artifactId>
    <version>3.1</version>
    <configuration>
        <argLine>-Xmx1024m</argLine>
        <source>1.6</source>
        <target>1.6</target>
    </configuration>
</plugin>

这些都不起作用。

还有其他方法可以处理 pom 文件中的-Xmx 参数吗?

【问题讨论】:

    标签: maven maven-compiler-plugin


    【解决方案1】:

    您必须在配置中使用&lt;fork&gt;true&lt;/fork&gt;,因为您无法影响当前正在运行的进程中的内存设置。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2013-09-15
      • 2016-01-21
      • 2019-08-15
      • 2023-04-07
      • 1970-01-01
      • 2018-04-09
      • 2011-10-10
      相关资源
      最近更新 更多