-
Notifications
You must be signed in to change notification settings - Fork 132
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Could not remove legal directory. Only on mac and linux? #328
Comments
Hi @Osiris-Team! JavaPackager/src/main/java/io/github/fvarrui/javapackager/utils/FileUtils.java Lines 244 to 251 in fa1ca46
I'm not really sure why Maybe we can try removing folders on Linux and Mac OS using the native command public static void removeFolder(File folder) throws Exception {
Logger.info("Removing folder [" + folder + "]");
try {
if (Platform.windows.isCurrentPlatform())
deleteDirectory(folder);
else {
CommandUtils.execute("rm", "-fr", folder);
}
} catch (IOException e) {
throw new Exception("Could not remove folder " + folder, e);
}
} I'll apply this patch and publish a snapshot version ASAP so you can test it. |
@fvarrui I think I had a similar issue in another project. What I did was to create a for loop that retries to delete the file like 1000 times or so and only then throw an exception. That worked since the files seemed to be locked only for a short time. |
Work in progress in branch |
Changes published as snapshot version Please, test it and give some feedback. |
If this patch doesn't work, I'll try your approach |
Yes that fixed it! Beautiful, thanks! |
I'm going to keep this issue open until this patch is released |
Branch |
1.7.3 released to Maven Central |
I'm submitting a…
Short description of the issue/suggestion:
When trying to package on mac:
Caused by: java.io.IOException: Unable to delete directory /Users/runner/work/Desku-Gradle-Starter-App/Desku-Gradle-Starter-App/desktop/build/desktop/desktop.app/Contents/PlugIns/jre.jre/Contents/Home/legal. at org.apache.commons.io.FileUtils.deleteDirectory(FileUtils.java:1127) at io.github.fvarrui.javapackager.utils.FileUtils.removeFolder(FileUtils.java:247) ... 121 more
Full build log: https://github.com/Osiris-Team/Desku-Gradle-Starter-App/actions/runs/5032033612/jobs/9025447503
When trying to package on linux/ubuntu:
Caused by: java.io.IOException: Unable to delete directory /home/runner/work/Desku-Gradle-Starter-App/Desku-Gradle-Starter-App/desktop/build/desktop/jre/legal. at org.apache.commons.io.FileUtils.deleteDirectory(FileUtils.java:1127) at io.github.fvarrui.javapackager.utils.FileUtils.removeFolder(FileUtils.java:247) ... 149 more.
Full build log: https://github.com/Osiris-Team/Desku-Gradle-Starter-App/actions/runs/5032033612/jobs/9025447469
It's a multi-module project: https://github.com/Osiris-Team/Desku-Gradle-Starter-App
Steps to reproduce the issue/enhancement:
release.yml contains the commands executed for each platform: https://github.com/Osiris-Team/Desku-Gradle-Starter-App/blob/master/.github/workflows/release.yml
Relevant build.gradle file: https://github.com/Osiris-Team/Desku-Gradle-Starter-App/blob/master/desktop/build.gradle
Note that on windows that build.gradle file works without issues.
The text was updated successfully, but these errors were encountered: