build of IDEA failed: directory not empty
Answered
I just had a build fail apparently in the process of cleaning the compiler output directory. A directory not empty exception was thrown. The directory contains a .DS_Store file.
I have had similar problems in my own code. I don't know how these files are being created. They are in directories that I have not displayed in Finder. Also I don't know why the files are not deleted.
I have only a screenshot of the error message. Upload id: 2022_05_12_MaLf2TRjayHTbBqK (file: Screen Shot 2022-05-12 at 9.43.59 AM.png)
I am running macOS 12.3.1.
Please sign in to leave a comment.
Please clarify
1) what is "a build"? what exactly did you invoke?
2) what is your current IDE version
3) what is the branch of IJ project?
4) please provide all relevant log files in raw form, not screenshots please
I now believe that the .DS_Store files are being created by the Finder as part of its implementation of the Calculate All Sizes option in some ancestor directory. The Finder is monitoring the entire directory tree for changes so that it can recalculate the sizes of individual subtrees; when it is notified of a change, it recalculates the content size of the subtree and caches the size in a .DS_Store file, creating it if not already present. IDEA deletes the build output tree using a recursive traversal that deletes the contents of a directory and then deletes the directory. Deleting a file in the directory can trigger the Finder to recalculate the directory size. If this happens after IDEA has deleted any existing .DS_Store file and before IDEA tries to delete the directory, the delete directory operation will fail because of the newly created .DS_Store file. I consider this to be a macOS bug, but it has been around for a while and I am not optimistic that Apple will fix it anytime soon. Some defensive programming in IDEA might be appropriate.
I also had this issue.
I manually patched some of the build "scripts" to remove `.DS_Store` when the zip is created.
Also I had to disable the notarization (and the DMG generation).
But this work now !
https://youtrack.jetbrains.com/issue/IDEA-317409/Only-Info.plist-file-is-allowed-in-IntelliJ-IDEA-CE.app-Contents-directory-but-found-IntelliJ-IDEA-CE.app-Contents-.DSStore