ant编译时报Java heap space 资源不足错误

论坛 期权论坛 编程之家     
选择匿名的用户   2021-6-2 16:38   1117   0
在build.xml文件中找到<target="compile">那一项,我的工程是这样的:

<target name="compile"
depends="prepare,copy">
<echo message="Compiling the source code!"/>

<javac srcdir="${basedir}/src"
destdir="${basedir}/WebRoot/WEB-INF/classes"
source="1.5"
debuglevel="error"
encoding="gb2312"
failοnerrοr="true"
nowarn="on"
">

<classpath refid="lib"/>
<compilerarg value="-Xlint:deprecation"/>
<compilerarg value="-Xlint:unchecked"/>
</javac>
</target>

初始的时候没有设置编译时jvm内存的大小,现在在<javac>中加入:fork="true"
memoryMaximumSize="512m"这两个参数:即改为:

<target name="compile"
depends="prepare,copy">
<echo message="Compiling the source code!"/>

<javac srcdir="${basedir}/src"
destdir="${basedir}/WebRoot/WEB-INF/classes"
source="1.5"
debuglevel="error"
encoding="gb2312"
failοnerrοr="true"
nowarn="on"

fork="true"
memoryMaximumSize="512m"
>

<classpath refid="lib"/>
<compilerarg value="-Xlint:deprecation"/>
<compilerarg value="-Xlint:unchecked"/>
</javac>
</target>

记得把fork设为true,否则默认不加的话是false,是不会读取memoryMaximumSize参数的!

分享到 :
0 人收藏
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

积分:3875789
帖子:775174
精华:0
期权论坛 期权论坛
发布
内容

下载期权论坛手机APP