nilTheDev
01/18/2022, 5:10 AMgradle
. gradle build
isn't working. It's quitting with the following message,
Unable to delete directory '/home/nilthedev/Documents/code/ktor-sample/build/classes/kotlin/main'
Failed to delete some children. This might happen because a process has files open or has its working directory set in the target directory.
Here is the complete error message,
Gradle version: 7.1
./gradlew build
Starting a Gradle Daemon, 3 stopped Daemons could not be reused, use --status for details
> Task :compileKotlin FAILED
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':compileKotlin'.
> Unable to delete directory '/home/nilthedev/Documents/code/ktor-sample/build/classes/kotlin/main'
Failed to delete some children. This might happen because a process has files open or has its working directory set in the target directory.
- /home/nilthedev/Documents/code/ktor-sample/build/classes/kotlin/main/com/example/ApplicationKt.class
- /home/nilthedev/Documents/code/ktor-sample/build/classes/kotlin/main/com/example/plugins/RoutingKt.class
- /home/nilthedev/Documents/code/ktor-sample/build/classes/kotlin/main/com/example/plugins/RoutingKt$configureRouting$1.class
- /home/nilthedev/Documents/code/ktor-sample/build/classes/kotlin/main/com/example/plugins/RoutingKt$configureRouting$1$1.class
- /home/nilthedev/Documents/code/ktor-sample/build/classes/kotlin/main/com/example/plugins/RoutingKt$configureRouting$1$1$1.class
- /home/nilthedev/Documents/code/ktor-sample/build/classes/kotlin/main/com/example/plugins
- /home/nilthedev/Documents/code/ktor-sample/build/classes/kotlin/main/com/example
- /home/nilthedev/Documents/code/ktor-sample/build/classes/kotlin/main/com
- /home/nilthedev/Documents/code/ktor-sample/build/classes/kotlin/main/META-INF/com.example.ktor-sample.kotlin_module
- /home/nilthedev/Documents/code/ktor-sample/build/classes/kotlin/main/META-INF
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
* Get more help at <https://help.gradle.org>
BUILD FAILED in 7s
1 actionable task: 1 executed
Things tried,
1. invalidate caches and restart
2. restarting the system
3. ./gradlew --stop
4. Tried finding whether any other program using the directory with the lsof
command lsof /home/nilthedev/Documents/code/ktor-sample/build/classes/kotlin/main/
, however it returned nothing which implies no other process is using the directory.
UPDATE:
I manually deleted the build
directory. Apparently, it solved the problem.