2013-06-18 52 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插件?

回答