Issue Description
Running "gradle clean" failed to artifacts from project output directory. After enable --stacktrace I can see below error
Caused by: org.gradle.api.file.UnableToDeleteFileException: Unable to delete file: C:\Users\xxxx\my-project-root\build\libs\some.jar
Here is my "gradle --version" output
------------------------------------------------------------
Gradle 5.1.1
------------------------------------------------------------
Build time: 2019-01-10 23:05:02 UTC
Revision: 3c9abb645fb83932c44e8610642393ad62116807
Kotlin DSL: 1.1.1
Kotlin: 1.3.11
Groovy: 2.5.4
Ant: Apache Ant(TM) version 1.9.13 compiled on July 10 2018
JVM: 1.8.0_152 (Oracle Corporation 25.152-b16)
OS: Windows 10 10.0 amd64
Initially my thought process was that some gradle daemon might be still be holding a reference to build artifacts. But after running "gradle --stop" I still get the same error for clean task.
Do note that if I open command prompt/powershell with administrative mode ":clean" tasks works fine.
I am not sure if anyone has faced this strange issue.
Solution
Please suggest if any.
gradle cleanandgradle --stopas Administrator you would be able to compile as a normal user.