ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
Subject Problem deleting a file
Date Thu, 14 Jul 2011 16:37:34 GMT

I'm using ant 1.8.2 on Windows 7/64 bit

One of the tasks in my build script deletes a target file before it is 
The trouble is the file doesn't actually seem to get deleted until after 
ant exits.
This causes ant to generate an error when it tries to create the new 
version of the file.

Below is the relevant bit of the build script in case there is something 
I'm doing wrong.
The file in question is Quentin.jar. If I have a window open on the 
directory containing
this file, I can see it doesn't get deleted until after ant exits. When 
this happens, ant
fails with the error

     [echo] Creating Quentin JAR
      [jar] Building jar: P:\Quentin\Manager\Java\tmp\Quentin.jar
     [move] Moving 1 file to P:\Quentin\Manager\Java\jars

P:\Quentin\Manager\build.xml:459: Failed to copy 
P:\Quentin\Manager\Java\tmp\Quentin.jar to 
P:\Quentin\Manager\Java\jars\Quentin.jar due to 
P:\Quentin\Manager\Java\jars\Quentin.jar (Access is denied)

Any help would be much appreciated


Andy Ling

        <target name="init" unless="init_done">
                <uptodate property="quentin_jar_ok" 
                        <srcfiles dir="${root}/idl" 
                        <property name="init_done" value="true"/>

        <target name="Quentin" if="docompile" depends="init">
                <javac includeantruntime="false" srcdir="${tmp-dir}" 
includes="com\quantel\Quentin\**" destdir="${outdir}" debug="${debug}" 
                        <compilerarg line="${compiler_cmdline}"/>

        <target name="idl_compile" if="docompile" depends="init,Quentin"/>

        <target name="idl_renew_src" depends="init">
                <delete dir="${tmp-dir}\com\quantel\Quentin"/>
                <delete file="${jar-files}\Quentin.jar"/>

                <!-- Make sources -->
                <echo>Building Quentin from IDL</echo>
                <exec executable="${env.JACORB_HOME}\bin\idl.bat">
                        <arg value="-all"/>
                        <arg value="-genEnhanced"/>
                        <arg value="-d"/>
                        <arg value="${tmp-dir}"/>
                        <arg value="-i2jpackage"/>
                        <arg value="Quentin:com.quantel.Quentin"/>

        <target name="Quentin.jar" unless="quentin_jar_ok" depends="init">
                <antcall target="idl_renew_src"/>
                <antcall target="idl_compile"/>
                <echo>Creating Quentin JAR</echo>
                <jar jarfile ="${tmp-dir}\Quentin.jar">
                        <fileset dir="${outdir}">
name="com/quantel/Quentin/**/*.class" />
                <move file="${tmp-dir}\Quentin.jar" todir="${jar-files}"/>


This e-mail is intended for the named addressees only. Its contents may be 
privileged or confidential and should be treated as such. If you are not 
an intended recipient please notify the sender immediately and then delete 
it;  do not copy, distribute, or take any action based on this e-mail. In 
the pursuit of its legitimate business activities and its conformance with 
relevant legislation, Quantel may access any e-mail (including 
attachments) it originates or receives, for potential scrutiny. 

Quantel is the trade name used by Quantel Holdings Limited and its 
subsidiaries.  Quantel Holdings Limited is registered in England & Wales. 
Registration No: 4004913 
Contact details for all Quantel Offices and Companies can be found on our 
website or by writing to the holding company.
Registered address: Turnpike Road, Newbury, Berkshire, RG14 2NX, United 

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message