I have encountered this problem when stating the classpath in each task, what happened was that I not only got several instances of each class but each target loaded a new instance of the class code on a large build it consumed a lot of memory. (This was with the sql task)
I removed the classpath in each task and instead added it to the ant classpath that fixed the problem /Johan -----Original Message----- From: H�l�ne JOANIN [mailto:[EMAIL PROTECTED]] Sent: den 16 november 2001 14:39 To: [EMAIL PROTECTED] Cc: HELENE JOANIN Subject: java.io.IOException: Not enough space Hi, I'm a new user of Ant and I need advice to be able to correct my problem. I use the Ant version 1.4.1. I have writen an Ant build file to build my product. The building works fine on a machine which have 512M memory. But I have the following error: java.io.IOException: Not enough space when I try to build my product on a machine which have 256M memory. However, on this machine, I am able to fully build my product by calling several times ant (without cleaning my building environment). I haven't find any information about this kind of memory problem on the Ant mailing list and on the Ant FAQ. I don't known if it's a 'normal' problem, (because Ant needs a lot of memory resource :-( ), or if it's due to a bug of Ant, or if it's due to my 'non well-writed' build file ? The building process of my product is quite complex, and I probably not write the building file on the "Ant Spirit". I will try to describe the building process more in details, in order for you to give me advise. I can already make two remarks: - the <antcal> task is frequently used, - the 'fork' attribute of the <java> task is set to "yes" to be able to stop the buildprocess on error. Thanks a lot for any clue. Kind regards. H�l�ne. 1) The main goal of my building process. ======================================== It's simply to build a jar ! This jar file is composed of : - classes extracted from 'externals' jar files, - classes builded from java sources; note that some java sources are builded - classes builded from others classes (stub and skel) 2) How classes are extracted from 'externals' jar files ? ========================================================= I got many jar files to unjar, and I want to unjar the jar file only if it is necessary. That's why I define three various targets. <target name="externals" depends="init"> <antcall target="unjar_ext"> <param name="dir" value="....." /> <param name="name" value="....." /> </antcall> <antcall target="unjar_ext"> <param name="dir" value="....." /> <param name="name" value="....." /> </antcall> .......... </target> <target name="unjar_ext"> <uptodate property="unjar.notRequired" targetfile="${build.classes.dir}/.${name}"> <srcfiles dir="${externals.dir}/${dir}" includes="${name}.jar"/> </uptodate> <antcall target="unjar_ext_if"> <param name="condition" value="unjar.notRequired"/> <param name="dir" value="${dir}"/> <param name="name" value="${name}"/> </antcall> </target> <target name="unjar_ext_if" unless="${condition}"> <unjar src="${externals.dir}/${dir}/${name}.jar" dest="${build.classes.dir}" /> <echo message="Classes of ${dir}/${name}.jar extracted" file="${build.classes.dir}/.${name}" /> </target> 3) The "compile" process. ========================= The compile process depends on - the extraction of the external jar classes, - the precompile process, - the java sources compilation, - the Stub/Skel generation. The precompile process is composed of two various process. The goal is to build java sources - from java source 'templates', this is the jpp process; - and from XML schema, this is the castor process. The jpp and castor tools are java programs which are not Ant tasks. As I want to stop the buildprocess if the command fail, I set the 'fork' attribute of the <java> task to "yes". a) The JPP precompile process. ------------------------------ <target name="precompile_jpp_all" > <antcall target="precompile_jpp"> <param name="name" value="....."/> </antcall> <antcall target="precompile_jpp"> <param name="name" value="....."/> </antcall> ..... </target> <target name="precompile_jpp"> <uptodate property="jpp.notRequired" targetfile="${build.classes.dir}/${name}.class"> <srcfiles dir="${src.dir}" includes="${name}.jpp"/> </uptodate> <antcall target="precompile_jpp_if"> <param name="name" value="${name}"/> </antcall> </target> <target name="precompile_jpp_if" unless="jpp.notRequired"> <java classname="${preprocessor.jpp}" fork="true" failonerror="true"> <arg value="-D"/> <arg value="${objectweb_orb}"/> <arg path="${src.dir}/${name}.jpp"/> <classpath refid="base.classpath"/> </java> </target> b) The castor precompile processor ---------------------------------- <target name="precompile_castor"> <uptodate property="castor.notRequired" targetfile="....."> <srcfiles dir= "....." includes="**/*.xsd"/> </uptodate> <antcall target="precompile_castor_" /> </target> <target name="precompile_castor_" unless="castor.notRequired"> <java classname="${preprocessor.castor}" fork="true" failonerror="true" dir="....."> <arg value="...."/> <arg path="...."/> <classpath refid="base.classpath"/> </java> ..... </target> c) The compilation of java sources process ------------------------------------------ This is made by using the <javac> task. d) The stub and skel building process ------------------------------------- As the Stub/Skel compiler is not the rmic standard compiler, and as this compiler is a java program which is not an Ant task, the targets define to the Stub/Skel build process looks like the targets define to the JPP precompile process. -- -=- H�l�ne JOANIN -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- mailto:[EMAIL PROTECTED] http://www.evidian.com Phone: 33.4.76.29.73.53 Fax: 33.4.76.29.76.00 Download our EJB Server JOnAS at http://www.objectweb.org -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]> -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>
