You are viewing a plain text version of this content. The canonical link for it is here.
Posted to ivy-user@ant.apache.org by Sky Ao <ao...@gmail.com> on 2010/04/16 16:30:42 UTC

Re: Why is Ivy locking my resolved dependencies until Ant finishesprocessing?

When you run "ant clean test release", the reserved jars are part of the classpath (for example target test ) and would be locked by the windows process to protected itself. So you can not delete these file
until the process exist and the file locks release.

I think "ant clean test release" would be in one process to run three target. For "ant clean,;ant test;ant release" there are three process to be executed one by one. When target release executes, the process of test has finished, of cause you can run target release to remove the jars.

2010-04-16 



Sky Ao 



发件人: Imner, Andreas 
发送时间: 2010-04-16  17:26:27 
收件人: ivy-user@ant.apache.org 
抄送: 
主题: Why is Ivy locking my resolved dependencies until Ant finishesprocessing? 
 
Hi 
I have a problem with Ivy that is blocking me from using it for creating my daily builds. I am using Windows and this problem does not appear on, for example, MacOS.
My daily build -Ant target triggers (among others), the following Ant targets
1. clean - cleaning /build and /lib
2. test  - resolving 3:rd party dependencies (conf="test") using Ivy to /lib, compiling classes + test classes and executing the junit tests
3. release - cleaning /build and /lib, resolving 3:rd party dependencies (conf="run") using Ivy, compiling the classes and assembling my webapp.
When running these targets within the same Ant "session" (like "/> ant clean test release") or when calling these targets from a single target, using the "ant" -task the following happens in the beginning of the "release" -target:
C:\dev\trunk\04_Implementation\webshop-ng\build.xml:228: Unable to delete file C:\dev\trunk\04_Implementation\webshop-ng\lib\activation-1.1.1.jar
But if I run the targets one by one, like 
ant clean
ant test
ant release
... the problems does not appear
If I add a <sleep minutes="5"/> to my build.xml and the use handle.exe, a sysinternals program for checking file handles, I can see that the Ant java process has file handles open for all the resolved 3rd party jars in /lib
Also as a test, during the <sleep.../>, I tried deleting the files in /lib using Windows explorer, but of course this didn't work either.
Does anyone have a solution or suggestion for this issue? I don't think Im the only one using windows and multiple targets withing the same Ant "session"?
Regards,
Andreas Imner 

RE: Why is Ivy locking my resolved dependencies until Ant finishes processing?

Posted by "Imner, Andreas" <An...@kgk.se>.
If this is true, why has the behaviour of my Ant targets and Hudson CI jobs changed when introducing Ivy?

Before I introduced Ivy to resolved dependencies, I used Ant -sub-targets that would simply copy the jars from an external directory to the /lib directory, like below.

1. clean - cleaning /build and /lib
2. test  - copy 3:rd party dependencies from external directory using Ant copy -tasks, ...
3. release - cleaning /build and /lib, copy 3:rd party dependencies from external directory using Ant copy -tasks, ....

With this setup, there was never any problems to run "ant clean test release" or call a main Ant -target that would call these sub-targets using <ant .../>

I don’t think this is a feature in Ant or Ivy in order to protect the files in the classpath?

Regards,

Andreas Imner 


-----Ursprungligt meddelande-----
Från: Sky Ao [mailto:aoxiaojian@gmail.com] 
Skickat: den 16 april 2010 16:31
Till: ivy-user
Ämne: Re: Why is Ivy locking my resolved dependencies until Ant finishesprocessing?


When you run "ant clean test release", the reserved jars are part of the classpath (for example target test ) and would be locked by the windows process to protected itself. So you can not delete these file
until the process exist and the file locks release.

I think "ant clean test release" would be in one process to run three target. For "ant clean,;ant test;ant release" there are three process to be executed one by one. When target release executes, the process of test has finished, of cause you can run target release to remove the jars.

2010-04-16 



Sky Ao 



发件人: Imner, Andreas 
发送时间: 2010-04-16  17:26:27 
收件人: ivy-user@ant.apache.org 
抄送: 
主题: Why is Ivy locking my resolved dependencies until Ant finishesprocessing? 
 
Hi 
I have a problem with Ivy that is blocking me from using it for creating my daily builds. I am using Windows and this problem does not appear on, for example, MacOS.
My daily build -Ant target triggers (among others), the following Ant targets
1. clean - cleaning /build and /lib
2. test  - resolving 3:rd party dependencies (conf="test") using Ivy to /lib, compiling classes + test classes and executing the junit tests
3. release - cleaning /build and /lib, resolving 3:rd party dependencies (conf="run") using Ivy, compiling the classes and assembling my webapp.
When running these targets within the same Ant "session" (like "/> ant clean test release") or when calling these targets from a single target, using the "ant" -task the following happens in the beginning of the "release" -target:
C:\dev\trunk\04_Implementation\webshop-ng\build.xml:228: Unable to delete file C:\dev\trunk\04_Implementation\webshop-ng\lib\activation-1.1.1.jar
But if I run the targets one by one, like 
ant clean
ant test
ant release
... the problems does not appear
If I add a <sleep minutes="5"/> to my build.xml and the use handle.exe, a sysinternals program for checking file handles, I can see that the Ant java process has file handles open for all the resolved 3rd party jars in /lib
Also as a test, during the <sleep.../>, I tried deleting the files in /lib using Windows explorer, but of course this didn't work either.
Does anyone have a solution or suggestion for this issue? I don't think Im the only one using windows and multiple targets withing the same Ant "session"?
Regards,
Andreas Imner