Failed to delete some children. This might happen because a process has files open or has its working directory set in the target directory

DevOps

MOTOSHARE 🚗🏍️
Turning Idle Vehicles into Shared Rides & Earnings

From Idle to Income. From Parked to Purpose.
Earn by Sharing, Ride by Renting.
Where Owners Earn, Riders Move.
Owners Earn. Riders Move. Motoshare Connects.

With Motoshare, every parked vehicle finds a purpose. Owners earn. Renters ride.
🚀 Everyone wins.

Start Your Journey with Motoshare

Error:

Unable to delete directory 'C:\_d\mycompany\WSs\demo\build'
  Failed to delete some children. This might happen because a process has files open or has its working directory set in the target directory.
  - C:\_d\mycompany\WSs\demo\build\classes\kotlin\main\com\mybank
  - C:\_d\mycompany\WSs\demo\build\classes\kotlin\main\com
  - C:\_d\mycompany\WSs\demo\build\classes\kotlin\main
  - C:\_d\mycompany\WSs\demo\build\classes\kotlin\test\com
  - C:\_d\mycompany\WSs\demo\build\classes\kotlin\test
  - C:\_d\mycompany\WSs\demo\build\classes\kotlin
  - C:\_d\mycompany\WSs\demo\build\classes
  - C:\_d\mycompany\WSs\demo\build\generated\source\kapt
  - C:\_d\mycompany\WSs\demo\build\generated\source\kaptKotlin\main
  - C:\_d\mycompany\WSs\demo\build\generated\source\kaptKotlin\test
  - C:\_d\mycompany\WSs\demo\build\generated\source\kaptKotlin
  - C:\_d\mycompany\WSs\demo\build\generated\source
  - C:\_d\mycompany\WSs\demo\build\generated
  - C:\_d\mycompany\WSs\demo\build\kotlin\compileKotlin\caches-jvm\inputs
  - C:\_d\mycompany\WSs\demo\build\kotlin\compileKotlin\caches-jvm\jvm\kotlin
  - C:\_d\mycompany\WSs\demo\build\kotlin\compileKotlin\caches-jvm\jvm
  - and more ...
  New files were found. This might happen because a process is still writing to the target directory.
  - C:\_d\mycompany\WSs\demo\build\kotlin\compileKotlinCode language: JavaScript (javascript)

Solution:

The problem is that you have multiple Gradle processes that are still holding locks to your files.

You can try running gradle –stop when this happens to stop any daemons that are running in the background (this usually helps).

You can also check the state of your daemons by running gradle –status. For me this outputs:

The problem is that you have multiple Gradle processes that are still holding locks to your files.

You can try running gradle --stop when this happens to stop any daemons that are running in the backgorund (this usually helps).

You can also check the state of your daemons by running gradle --status. For me this outputs:Code language: JavaScript (javascript)

If you notice anything there, there may be an issue.

Although –no-daemon and –no-parallel may be helpful, they will only serve to mask the true issue.

When this occurred in my situation, I discovered that processes were running in the background as a result of tests that never ended. Check for open or unfinished processes across all of your threading and/or coroutine usage.

I also experienced this when I used ProcessBuilder to launch another Java process, however, it failed to terminate.

Subscribe
Notify of
guest

This site uses Akismet to reduce spam. Learn how your comment data is processed.

0 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x