# \`gradle\` compiler erased files/folders under my home directory

**URL:** https://discuss.gradle.org/t/gradle-compiler-erased-files-folders-under-my-home-directory/45134
**Category:** Help/Discuss
**Created:** [March 11, 2023, 4:11pm UTC](https://discuss.gradle.org/t/gradle-compiler-erased-files-folders-under-my-home-directory/45134 "2023-03-11T16:11:29Z")
**Posts on this page:** 10
**Page:** 1

<div class="post-metadata">

### Author: ![lnx-usr](https://avatars.discourse-cdn.com/v4/letter/l/e480ec/32.png) [@lnx-usr](https://discuss.gradle.org/u/lnx-usr)
#### Post date: [March 11, 2023, 4:11pm UTC](https://discuss.gradle.org/t/gradle-compiler-erased-files-folders-under-my-home-directory/45134/1 "2023-03-11T16:11:30Z")

</div>

I cloned `gradle` from `https://github.com/gradle/gradle` and worked on building it on `linux x86_64` (Fedora 37). I did not modify any of the configuration files. As `gradle` finished building, it erased/deleted - seemingly on cleanup - files and folders I had under `$HOME`. I looked under `$HOME/.gradle/caches`, `/tmp`, Trash, but could not find any of the erased files/folders. I read about the gradle directories at `https://docs.gradle.org/current/userguide/directory_layout.html` and could understand that cleanup is done automatically on cleanup. Is there a way to recover the `BuildDirectory` and how? I assume that this `BuildDirectory`- if recovered - will have the files/folders I lost. Thanks in advance.

I do not expect any package or compiler to erase/delete material - especially system files and folders - that does not belong to the package itself. I also expect the compiler to ask and let the user decide and further emit a warning message before it erases any files or folders. The issue becomes more serious when such files and folders are system ones. The development team is kindly asked to look into this issue and put in place warnings and a security check that prevents `gradle` from erasing/deleting system files and folders as well as owner files and folders that do not belong to `gradle` itself.

---

<div class="post-metadata">

### Author: ![Vampire](https://sea1.discourse-cdn.com/gradle/user_avatar/discuss.gradle.org/vampire/32/9082_2.png) [@Vampire](https://discuss.gradle.org/u/Vampire)
#### Post date: [March 11, 2023, 5:04pm UTC](https://discuss.gradle.org/t/gradle-compiler-erased-files-folders-under-my-home-directory/45134/2 "2023-03-11T17:04:17Z")

</div>

I highly doubt it did, to be honest.  
I’ve never seen the Gradle build to erase anything on my disk outside its project directory.  
But if you are sure about that, you should probably open a bug report / improvement request on the Gradle issue tracker instead of a post in the community forum.  
It is unlikely something will change just by complaining here. 🙂

---

<div class="post-metadata">

### Author: ![lnx-usr](https://avatars.discourse-cdn.com/v4/letter/l/e480ec/32.png) [@lnx-usr](https://discuss.gradle.org/u/lnx-usr)
#### Post date: [March 12, 2023, 12:32am UTC](https://discuss.gradle.org/t/gradle-compiler-erased-files-folders-under-my-home-directory/45134/3 "2023-03-12T00:32:26Z")

</div>

It did. I compiled under `$HOME` as I wanted the package to install under `$HOME/.gradle`. System files and folders and my personal files and folders under `$HOME` were all erased by the compiler.

---

<div class="post-metadata">

### Author: ![Vampire](https://sea1.discourse-cdn.com/gradle/user_avatar/discuss.gradle.org/vampire/32/9082_2.png) [@Vampire](https://discuss.gradle.org/u/Vampire)
#### Post date: [March 12, 2023, 4:47pm UTC](https://discuss.gradle.org/t/gradle-compiler-erased-files-folders-under-my-home-directory/45134/4 "2023-03-12T16:47:33Z")

</div>

I don’t really understand what you mean with “compiled under `$HOME`”.

If you checked out the Gradle repository at `$HOME` so that you have `$HOME/settings.gradle.kts`, `$HOME/version.txt`, and so on, then you made your whole `$HOME` directory the project directory of the Gradle build and I wouldn’t wonder if that breaks things. But you surely didn’t mean that, as it sounds pretty strange.

If you want it installed under `$HOME/.gradle`, which does not sound like the best idea either, you would just set the according Gradle property (`gradle_installPath`) to the according directory as documented in `CONTRIBUTING.md`.

---

<div class="post-metadata">

### Author: ![lnx-usr](https://avatars.discourse-cdn.com/v4/letter/l/e480ec/32.png) [@lnx-usr](https://discuss.gradle.org/u/lnx-usr)
#### Post date: [March 16, 2023, 1:06pm UTC](https://discuss.gradle.org/t/gradle-compiler-erased-files-folders-under-my-home-directory/45134/5 "2023-03-16T13:06:49Z")

</div>

Can the erased files be recovered? Can `make install` be reversed with `make uninstall`?

---

<div class="post-metadata">

### Author: ![Vampire](https://sea1.discourse-cdn.com/gradle/user_avatar/discuss.gradle.org/vampire/32/9082_2.png) [@Vampire](https://discuss.gradle.org/u/Vampire)
#### Post date: [March 16, 2023, 1:54pm UTC](https://discuss.gradle.org/t/gradle-compiler-erased-files-folders-under-my-home-directory/45134/6 "2023-03-16T13:54:42Z")

</div>

`make`?  
Gradle build does not use makefiles.  
If you meant `./gradlew uninstall`, no.  
Even if that would exist, it could not magically undelete files.  
For undeleting deleted files, you need to have a backup of these files.

---

<div class="post-metadata">

### Author: ![lnx-usr](https://avatars.discourse-cdn.com/v4/letter/l/e480ec/32.png) [@lnx-usr](https://discuss.gradle.org/u/lnx-usr)
#### Post date: [March 17, 2023, 5:24pm UTC](https://discuss.gradle.org/t/gradle-compiler-erased-files-folders-under-my-home-directory/45134/7 "2023-03-17T17:24:58Z")

</div>

Thanks. But `gradlew install` wiped out files. Where do such files go?

---

<div class="post-metadata">

### Author: ![Vampire](https://sea1.discourse-cdn.com/gradle/user_avatar/discuss.gradle.org/vampire/32/9082_2.png) [@Vampire](https://discuss.gradle.org/u/Vampire)
#### Post date: [March 17, 2023, 6:59pm UTC](https://discuss.gradle.org/t/gradle-compiler-erased-files-folders-under-my-home-directory/45134/8 "2023-03-17T18:59:22Z")

</div>

The way of all mortal I guess

---

<div class="post-metadata">

### Author: ![lnx-usr](https://avatars.discourse-cdn.com/v4/letter/l/e480ec/32.png) [@lnx-usr](https://discuss.gradle.org/u/lnx-usr)
#### Post date: [March 18, 2023, 6:27pm UTC](https://discuss.gradle.org/t/gradle-compiler-erased-files-folders-under-my-home-directory/45134/9 "2023-03-18T18:27:34Z")

</div>

For the benefit of others, here is the link to the issue lodged at `github`:  
[https://github.com/gradle/gradle/issues/24252](https://github.com/gradle/gradle/issues/24252)

---

<div class="post-metadata">

### Author: ![lnx-usr](https://avatars.discourse-cdn.com/v4/letter/l/e480ec/32.png) [@lnx-usr](https://discuss.gradle.org/u/lnx-usr)
#### Post date: [March 23, 2023, 1:37pm UTC](https://discuss.gradle.org/t/gradle-compiler-erased-files-folders-under-my-home-directory/45134/10 "2023-03-23T13:37:15Z")

</div>

At [https://github.com/gradle/gradle/pull/24376](https://github.com/gradle/gradle/pull/24376) one can see that the latest build will - on installation - prevent `gradle` from deleting an existing directory. Messages will be generated to help the user.
