[GRADLE-2244] Cleaning should be more robust on Windows Created: 19/Apr/12  Updated: 04/Jan/13  Resolved: 23/Jul/12

Status: Resolved
Project: Gradle
Affects Version/s: None
Fix Version/s: 1.1-rc-1

Type: Improvement
Reporter: Luke Daley Assignee: Luke Daley
Resolution: Fixed Votes: 0


I'm seeing this on windows when the indexer is on.

It manifests as java.io.IOException: Unable to delete file/directory, and then a subsequent clean will succeed.

We could cater for this by noting that a particular operation failed, and then retrying it again at the end or after some time.

Comment by Szczepan Faber [ 23/Apr/12 ]

If we develop this feature they will probably have to remember all undeletable dirs. So I'd vote to also improve the error message to include the list of all dirs that the build could not delete at clean. This would be very useful in windows.

Comment by Luke Daley [ 21/Jul/12 ]


I'm inclined not to include this. The reason is that it actually makes the logic non trivially more complex, and would only really help in the situation where someone has asked to delete multiple roots which is rare. Typically the delete is just operating on the “build dir”.

Comment by Luke Daley [ 23/Jul/12 ]

After some research, it appears that this may be due to a bug in the Windows JDKs (incl IBM). Ant uses a strategy of forcing a GC after a failed delete and then waiting a small amount of time. Given that this appears to be a successful strategy for Ant, we have adopted it.

Generated at Wed Jun 30 12:16:37 CDT 2021 using Jira 8.4.2#804003-sha1:d21414fc212e3af190e92c2d2ac41299b89402cf.