28

I run eclipse on Ubuntu 11.10. I originally created a project in folder foo. I subsequently deleted that project to re-organise folders and I now want to create a new project in folder foo/bar but Eclipse won't let me because it says the the new directory is a sub-directory of an existing project.

How can I force Eclipse to forget about the original project so that I can create the new one?

Bruno Girin
  • 436
  • 1
  • 4
  • 5
  • I still have issues with this and it is driving me mad. Every time I delete a project (and all of its content), eclipse remembers there used to be a project in that directory and prevents me from re-using that location. I just cannot find any config file that stores that information. – Bruno Girin Apr 30 '12 at 18:30
  • I tried this: find $HOME -name ".project" -print And this: find $HOME -type f | while read f; do grep -H -n projectname "$f"; done And checked this location too: /.metadata/.plugins/org.eclipse.core.resources/.projects But still no luck. – Bruno Girin Apr 30 '12 at 18:52

10 Answers10

49

In general, the deleting the project from the "/.metadata/.plugins/org.eclipse.core.resources/.projects" should work, but if you're using 'working sets', you might have the problem I had once, which is basically have a 'ghost' project in your workspace that you can't delete because it says "this project doesn't exist anymore".

If this is your problem, try to delete an entry for your 'ghost project' in the file:

"/.metadata/.plugins/org.eclipse.ui.workbench/workingsets.xml" (on MacOS).

Alécio Carvalho
  • 13,481
  • 5
  • 68
  • 74
  • 4
    The /.metadata/.plugins/org.eclipse.ui.workbench/workingsets.xml solution worked great for me. – ecbrodie Nov 11 '14 at 19:36
  • 3
    tfw you find this answer after a long time and cannot upvote again :-) – JohnEye May 30 '17 at 14:18
  • 1
    Awesome........I spent 1 day on this BS problem...Literally, you saved me man..!!!!!!!!!! Big Hug... – Nish Aug 23 '17 at 06:27
  • 1
    I had a similar issue with a 'ghost' project but it didn't have an entry for the project in org.eclipse.ui.workbench/workingsets.xml. What fixed it for me was make an entry for the project in workingsets.xml (with Eclipse closed). After that I restarted Eclipse and the project showed up in the package explorer where I could delete it again. – dannygme Apr 19 '18 at 15:34
5

Delete the project from /.metadata/.plugins/org.eclipse.core.resources/.projects and not the whole .metadata folder will save all other projects and config.

Kajal
  • 59
  • 1
  • 2
4

I have also encountered this problem, except it's been in Windows. I didn't want to completely remove the .metadata folder and none of the other solutions fixed it.

I managed to fix it by removing the file workspace\.metadata\.plugins\org.eclipse.core.resources\.safetable\org.eclipse.core.resources while Eclipse was closed. The file gets saved when closing Eclipse so I guess it is cached while Eclipse is open.

Eric Finn
  • 8,629
  • 3
  • 33
  • 42
  • 5
    that ruined my workspace completely and I had to set it up from the start again, make sure to keep a copy of `.safetale\org.eclipse.core.resources` if you want to try this – outofmind Apr 07 '17 at 07:43
  • This worked in a Docker container that I've built a Python dev environment in; although it did have the side-effect of removing all projects from the explorer. But, no other solutions worked for me, so I just went to `file>open projects from file system` and added everything back. The `org.core.resources` file was regenerated and all is well. – Hildy Apr 15 '18 at 02:53
  • Same here - Lost my entire workspace. I should have known better than to just blow the file away rather than taking a look first. – Jack Mason Feb 04 '22 at 22:38
2

I finally managed to fix it by deleting the workspace/.metadata directory. This resolves the problem but has the side effect of making eclipse forget everything about the workspace so I'm not sure it's a recommended way of fixing the problem.

Bruno Girin
  • 436
  • 1
  • 4
  • 5
2

I am running Eclipse Kepler on OS X Mountain Lion, and I had a similar problem. I deleted a project and tried to recreate it in the same location. Eclipse gave me an error saying that the project already existed. I discovered that if I close Eclipse after deleting a project, then reopen it, Eclipse finally 'forgets' the deleted project and allows me to re-create it.

(This question was posted over 1.5 years ago, and I'm guessing that Bruno already tried this and it didn't work. I just want to let others know that this solution worked for me now on Kepler.)

ginger
  • 21
  • 1
2

Go to your workspace folder using some file manager (you can find your workspace location, be clicking File -> Swich Workspace...) and delete your foo folder, or simple remove its contents (.project file being most important). Then you should be able to create your new project.

Wojciech Owczarczyk
  • 5,595
  • 2
  • 33
  • 55
1

I had the same problem, with Egit and repositories that I deleted and imported back again, instead of importing as general project choose import as existing project.

PetMarion
  • 147
  • 3
  • 14
1

maybe you can try to delete the folders: "/your_workspace/.metadata/.plugins/org.eclipse.core.resources" "/your_workspace/ProjectName"

kwang
  • 11
  • 1
1

If the Project was in a working set before you deleted it, you might have to manually remove it from the set.

Blank Chisui
  • 1,043
  • 10
  • 25
0

Instead of deleting any file, rename it, so if whatever you try doesn't work, you can revert.

Jeff Silverman
  • 692
  • 1
  • 8
  • 15