I have a requirement where I have to run a while loop in ant script.
I have to check for the status of a file (it is being created by some other process) in the while loop and perform some task based on it.
I have a requirement where I have to run a while loop in ant script.
I have to check for the status of a file (it is being created by some other process) in the while loop and perform some task based on it.
I strongly urge you not to use third party tasks that provide looping capability if at all possible. Introducing programming logic such as loops and if statements can easily make your build scripts into unusable spaghetti code.
For your specific case, native Ant already has a much simpler solution. You can use the waitfor
task with a nested available
condition pointed to the file in question:
<waitfor>
<available file="/path/to/your/file" />
</waitfor>