2013-06-18 53 views
2

我正在使用maven-antrun-plugin将我的ant的build.xml转换为maven项目pom.xml,并且我得到java.lang.OutOfMemoryError:Java堆空间错误。当我尝试在构建时在复制一个相当大的文件2G到某个位置发生 此错误如何为maven antrun插件设置ANT_OPTS

这种情况的代码只是

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

现在使用maven-antrun-插件的pom.xml外观这样

<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> 
</..> 

在运行Ant构建的ANT_OPTS已被设置为-Xmx4g和ant脚本工作正常。但是当我运行maven包命令时,它会抛出一个错误,如下所示。

的蚂蚁BuildException已发生:java.lang.OutOfMemoryError:Java堆空间

我相信Maven插件犯规阅读ANT_OPTS环境变量,而是有一个默认值。是否有人知道为什么会发生这种情况,以及是否有办法将ANT_OPTS变量传递给antrun插件?

回答