2

I am converting my ant's build.xml to maven project pom.xml using the maven-antrun-plugin and i am getting java.lang.OutOfMemoryError: Java heap space error. This error occurs when i try to copy a fairly large file 2g in to a location during build time

the code for this is simply

<copy todir="dist/${cgapp.home}/${push.root}/${cgapp.toolchain}" >
            <fileset dir="${env.PUSH_TOOLCHAIN}" includes="**"/>
</copy>

Now using maven-antrun-plugin the pom.xml looks like this

<artifactId>maven-antrun-plugin</artifactId>
<executions>
<execution>
<phase>package</phase>
<configuration><exportAntProperties>true</exportAntProperties>
<target>
.........
    <copy verbose="true" todir="app/${cgapp.home}/${push.root}/${cgapp.toolchain}">                                   
    <fileset dir="${env.PUSH_TOOLCHAIN}" includes="**"/>                      
    </copy>
....
</target>
</..>

while running the ant build the ANT_OPTS has been setup to -Xmx4g and the ant scripts works fine. but when i run the maven package command it throws an error as shown below.

An Ant BuildException has occured: java.lang.OutOfMemoryError: Java heap space

I believe that the maven plugin doesnt read the ANT_OPTS env variable but rather has a default value. Does any one know why this is happening and if there a way to pass in ANT_OPTS variable to antrun plugin ?

4

1 回答 1

2

蚂蚁可能不是子进程。在这种情况下,您可以尝试 MAVEN_OPTS。查看Maven Out of Memory Build Failure 的一些提示

于 2013-06-18T07:29:18.847 回答