Running "gradle clean" fails because gradle daemon has files, stopping daemon doesn't stop daemon

So I happen to be building Gradle. I’ve been running this build with the daemon. I noticed that when I try to run “gradle clean” it fails because this tries to delete jar files that the daemon process has open (this is Windows 7). So, I decided that I would do “gradle --stop” and then “gradle --no-daemon clean”. This failed with the same error. When I looked at my processes, I found the Gradle daemon was still running. When I then did “gradle --stop”, it said “No Gradle daemons are running.”.

I then manually killed the daemon process and also commented out the “org.gradle.daemon = true” setting in my gradle.properties, mostly because I conclude that Gradle startup isn’t that slow for me without the daemon. The next “gradle clean” succeeded.

It’d be great to know if this is reproducible. What files were locked this way? It sounds like the daemon hit some errors that kept those files and prevented from clean exit.

I’ll set this back up again and record my results and get back to you.

So far, I haven’t been able to repeat this again. I did notice that when I look at the daemon process in Process Explorer, it seems “different” from when I was seeing this symptom. I’m almost thinking that when I was seeing this symptom, I didn’t see “Daemon” in the process command line anywhere. It almost seems like perhaps there were un-daemoned Gradle processes that somehow stuck around, and this was happening repeatedly, just not today.