It's not Windows' locking. (I have seen Windows locking
when I had Explorer open and tried to delete some directories)

What I found is that DELETE fails b/c it's proceded by a 
PropertyFile task AND a Copy task. Here is the code:
 <copy todir="${build.dir}\${package.root.dcmtools}">
        <fileset dir="${src.dir}\${package.root.dcmtools}">
                <include name="*.ini"/>
        </fileset> 
 </copy>

<!-- Set BulkLoad.ini values -->
<propertyfile file="${build.dir}\${package.root.dcmtools}\BulkLoad.ini" 
        comment="Customized for ${build.type} environment on">
    <entry key="HOST_DIR" value="${host.dir.bulkload}"/>
</propertyfile>

<delete file="${build.dir}\${package.root.dcmtools}\BulkLoad.ini"/>

Output is:
     [copy] BulkLoad.ini omitted as
C:\java\buildclasses\dcmtools\BulkLoad.ini is up to date.
     [copy] Certifier.ini omitted as
C:\java\buildclasses\dcmtools\Certifier.ini is up to date.
     [copy] MainMenu.ini omitted as
C:\java\buildclasses\dcmtools\MainMenu.ini is up to date.
     [copy] ProductDelete.ini omitted as
C:\java\buildclasses\dcmtools\ProductDelete.ini is up to date.
     [copy] Reports.ini omitted as
C:\java\buildclasses\dcmtools\Reports.ini is up to date.
[propertyfile] Updating property file:
C:\java\buildclasses\dcmtools\BulkLoad.ini
   [delete] Deleting:
C:\java\buildclasses\dcmtools\BulkLoad.ini

BUILD FAILED

d:\ant\buildpii.xml:724: Unable to delete file
C:\java\buildclasses\dcmtools\BulkLoad.ini
        at org.apache.tools.ant.taskdefs.Delete.execute(Delete.java:267)
        at org.apache.tools.ant.Task.perform(Task.java:217)
        at org.apache.tools.ant.Target.execute(Target.java:164)
        at org.apache.tools.ant.Target.performTasks(Target.java:182)
        at org.apache.tools.ant.Project.executeTarget(Project.java:601)
        at org.apache.tools.ant.taskdefs.Ant.execute(Ant.java:256)
        at
org.apache.tools.ant.taskdefs.CallTarget.execute(CallTarget.java:120)
        at org.apache.tools.ant.Task.perform(Task.java:217)
        at org.apache.tools.ant.Target.execute(Target.java:164)
        at org.apache.tools.ant.Target.performTasks(Target.java:182)
        at org.apache.tools.ant.Project.executeTarget(Project.java:601)
        at org.apache.tools.ant.Project.executeTargets(Project.java:560)
        at org.apache.tools.ant.Main.runBuild(Main.java:454)
        at org.apache.tools.ant.Main.start(Main.java:153)
        at org.apache.tools.ant.Main.main(Main.java:176)

When I did several PropertyFile tasks on different files and tried to
delete all of them write after, the DELETE always failed on the file
which properties were modified last. E.g. in:

<propertyfile file="A"/>
<propertyfile file="B"/>
<delete file="A"/>
<delete file="B"/>

DELETE on B will fail.

Also if I remove either PropertyFile or Copy task everything is OK.
Also if I replace Copy with FileSet to simple Copy file it also
works.

Also note that if there are multiple files like in the above example
all get deleted and it fails on the last one.

?????

 
On Tue, 11 Dec 2001, Magesh Umasankar wrote:

> From: "Dmitri G. Chtchekine" <[EMAIL PROTECTED]>
> 
> > I get exception trying to delete some files (OS is Windows NT).
> 
> Windows doesn't let a program delete any file that is "locked"
> by the OS at the time of attempting to delete.  Such is not the case
> in Unix.  So this problem will usually occur in Windows only.
> 
> >  Strangely some files get deleted, and on some ant failes.
> 
> Delete will fail only if some other task already holds an
> open handle to the file that you attempt to delete.  So, 
> please look at which task uses this file in the build
> before a delete attempt on it is made.  If it is a built-in
> task that doesn't close the file before you try to delete it,
> please let me know.  If it is some custom task that
> uses this file, you need to look into whether the file closes
> all Input/Output Streams that the task holds on the file.
> 
> Magesh
> 
> 
> 
> 
> --
> 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]>

Reply via email to