eclipse-jdt / eclipse-jdt/eclipse.jdt.ui
Deleting multiple interdependent projects triggers builds which prevent deletion
- Dominant language
- Java
- Stars
- 59
- Forks
- 127
- Avg merge
- 23h 30m
- Merged PRs (30d)
- 35
Description
Originally reported at https://bugs.eclipse.org/bugs/show_bug.cgi?id=550228
I see this issue very commonly when building multi-module m2e builds. However, I would expect the issue to occur in any workspace with multiple projects open which depend on one another, so it is not specific to m2e.
If I have, for example, 20 projects open, some of which depend on the others, and I select all 20 projects and delete them from the workspace, the deletion of some of them causes the ones that depend on them to rebuild, even though they are also scheduled for deletion. These projects fail to rebuild (because their dependency has been removed), and then are left in the workspace, instead of being deleted.
When this occurs in a multi-module m2e build, this causes additional errors, such as creation of bin/ directories and edits to .gitignore files, because the maven project is confused.
The workaround is to close all 20 projects first, and then delete them, so that rebuilds are not triggered.
It should be much easier to delete projects from the workspace. A good fix for this would be to *not* allow rebuilds to be triggered for a project if the UI is currently in the process of deleting it from the workspace.
This issue has existed for as long as I've been using Eclipse (nearly 10 years), and I'm finally getting annoyed with it enough to report it as a bug. :)
Instead of trying to track which projects are "scheduled for deletion" from the UI, it might be easier for the "delete project" action in the menu to execute a "close project" on all selected projects, before executing the "delete project" action which was requested.
The fix for this should be simple. It should just be changing the logic from something like:
selectedProjects.deleteAll()
to:
// close them all before trying to delete them, since closing several at once does not appear to trigger rebuilds like deleting does
try {
selectedProjects.closeAll();
} finally {
selectedProjects.deleteAll();
}
I made an attempt to figure out where I could make the change myself, to submit a patch for consideration, but it was not intuitive, as I'm not familiar with the code at all.
Steps to reproduce:
1. Create several projects in Eclipse that have dependencies on one another (the easiest way to do this is to import a multi-module Maven project like https://github.com/apache/accumulo)
2. Select all projects for deletion in the Eclipse UI, and delete
3. Observe that when the dependent projects are deleted, this triggers the depending projects to rebuild (example if A depends on B, and B is deleted first, even though they were both selected for deletion at the same time, A begins to rebuild)
4. Observe that the depending project fails to rebuild (because its dependent project has already been deleted first)
5. Observe that the depending project fails to be deleted and the UI shows an error
Contributor guide
Research direction
Start at the Eclipse UI delete-project action described in the issue, using the selectedProjects deleteAll() and closeAll() examples as entry points. Reproduce the multi-project dependency scenario, then verify that deleting all selected projects does not trigger rebuild failures and leaves no selected projects behind.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- desktop-dev, tooling
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100