ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From peter reilly <peter.rei...@corvil.com>
Subject Re: Unable to delete directory
Date Thu, 10 Jul 2003 09:32:34 GMT
Have you tried to use the nightly build of ant.

There was a fix recently to the jar task (by antoine) to
fix a very hard to find problem with the jar task
holding on to a file reference. I am not to sure that problem
relates to your problem, but you could give it a shot.

Peter

On Wed, 2003-07-09 at 18:48, Michael.Giroux@Bull.com wrote:
> I have searched the archive and found several messages about this problem,
> but no indication that anyone has acknowledged a problem in ANT.  A few
> users actually did have other processes with references to the directory,
> but a couple of the entries in the archive appear to have gone unresolved.
> I have now encountered the same problem, and did quite a bit of research
> trying to resolve the problem.
> 
> Problem: DELETE task fails because it is unable to delete a directory.
> 
> I have an ANT target that includes a delete task to remove an entire
> directory.  The directory contains several subdirectories of java class
> files that have been collected into a jar.
> 
> Using -debug option, and verbose='yes' on the delete task, I have
> determined that the failure occurs when deleting a directory that becomes
> empty as a result of deleting all subordinate files and directories.
> 
> I have confirmed that there are no command windows, or other processes
> accessing the directory.  Following the ANT failure, I am able to delete
> the directory manually using 'rmdir /s' command from the same command
> window.
> 
> I am providing a portion of the build.xml to illustrate the relavent tasks.
> 
> 1. in the server target, the delete task always fails.  With failonerror
> ='false' ANT will usually report 12 "Unable to delete" messages.  However,
> I have seen as many as 18, and as few as three.
> 2. in the client target, the first delete task always succeeds.  This
> confirms that no other processes have an open reference to the classes
> directory.
> 3. in the client target, the second delete task always reports two or three
> Unable to delete messages.
> 
> I moved the project to a network drive, and the ANT INSTALL task runs
> successfully with no errors reported by any of the delete tasks.
> 
> I turned OFF disk cache for WRITES, and this caused the number of Unable to
> delete messages to increase.  This led me to suspect that the problem is OS
> related.
> 
> In all cases, the error appears to occur following the delete of the last
> file within a directory, and the attempt to delete the empty directory.
> When ANT terminates, the only thing left in the classes directory is empty
> sub-directories.
> 
> All of this leads me to suspect that the reference to the directory is
> actually held by ANT itself, and ANT needs to have a small delay between
> the delete of the last file, and the attempt to delete the empty folder.
> Or perhaps there is an system call that will flush the file system buffers
> prior to attempting the delete.
> 
> Config:
> Windows XP
> 512 MB memory
> 
> 
> ------- Ant diagnostics report -------
> Apache Ant version 1.5.3 compiled on April 16 2003
> 
> -------------------------------------------
>  Implementation Version (JDK1.2+ only)
> -------------------------------------------
> core tasks     : 1.5.3
> optional tasks : 1.5.3
> 
> -------------------------------------------
>  ANT_HOME/lib jar listing
> -------------------------------------------
> ant.home: C:\java\apache-ant-1.5.3-1
> ant.jar (737884 bytes)
> bcel.jar (491551 bytes)
> optional.jar (671546 bytes)
> xercesImpl.jar (885250 bytes)
> xml-apis.jar (108484 bytes)
> 
> -------------------------------------------
>  Tasks availability
> -------------------------------------------
> stlist : Missing dependency com.starbase.starteam.Item
> telnet : Missing dependency com.oroinc.net.SocketClient
> ftp : Missing dependency com.oroinc.net.ftp.FTP
> jdepend : Missing dependency jdepend.xmlui.JDepend
> script : Missing dependency com.ibm.bsf.BSFException
> junit : Missing dependency junit.framework.TestListener
> stcheckin : Missing dependency com.starbase.starteam.Item
> stcheckout : Missing dependency com.starbase.starteam.Item
> 
> -------------------------------------------
>  org.apache.env.Which diagnostics
> -------------------------------------------
> Not available.
> Download it at http://xml.apache.org/commons/
> 
> -------------------------------------------
>  System properties
> -------------------------------------------
> java.runtime.name : Java(TM) 2 Runtime Environment, Standard Edition
> sun.boot.library.path : c:\java\j2sdk1.4.2\jre\bin
> java.vm.version : 1.4.2-b28
> java.vm.vendor : Sun Microsystems Inc.
> 
> -- build.xml extract --
> 
> <project name="jonas" default="install"  basedir=".">
> 
>   <target name="client"  >
>     <delete dir="classes" />
>     <mkdir dir="classes" />
>     <jar jarfile="lib/client.jar" update="true" basedir="classes">
>       <fileset dir="${jonas.root}/conf">
>         <include name="carol.properties"/>
>         <include name="jonathan.xml"/>
>         <include name="traceclient.properties"/>
>       </fileset>
> 
>       <manifest>
>       <attribute name="Main-Class" value
> ="org.objectweb.jonas.client.ClientContainer"/>
>       </manifest>
>     </jar>
> 
>     <delete dir="classes"  failonerror="false" includeEmptyDirs="true" />
>   </target>
> 
> 
> <target name="server" >
>     <jar jarfile="lib/jonas.jar" basedir="classes"/>
>     <delete dir="classes"  failonerror="false" includeEmptyDirs="true" />
>   </target>
> 
>   <target name="install"
>       description="build all"
>       depends="server,client">
>   </target>
> 
> </project>
> 
> 
> Michael Giroux
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
> For additional commands, e-mail: user-help@ant.apache.org
> 
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org


Mime
View raw message