Cannot create project from folder because it is already in the workspace - spring-tool-suite

I created a Spring project with SpringToolSuite from a SVN project. It worked successfully. Now I deleted the project without deleting the content on disk. I want to create a project from the folder of the previously deleted project but I could not create it : there is a message stating that a project of the same name already exists in the workspace. So how to fix that ?

I do not know about SPringToolSuite, I work with Visual Studio. There, if you remove your project from the solution happens the same, it kept on the hard drive just disappears from the solution explorer.
If you want to reopen it, you can just open the project file or add it back to your solution.
If you want to create another project with the same name at the same location, you have to manually delete or move the folder of your old excluded project.
Depending on your use case, you can try to do something similar.
I hope this helps.

Related

Eclipse project already exists

I deleted a project in my workspace, then tried to create a new project with the same name. Eclipse told me that it overlaps the location of another project (the one I just deleted). How do I fix this?
This is what I did.
Go to Window --> Show View --> Project Explorer
Then right click on the project name that you want to delete and Click Delete.
In the dialogue box, check 'Delete Project Contents on disk'
It worked. I was able to create the project with same name again.
I had the same problem with the IBM Integration Toolkit, which is based on Eclipse. The problem also occurs in Android Studio, which is also based on Eclipse. crazyscot seems to have the right answer at A project with that name already exists in the workspace eclipse and his solution worked for me.
You need to open up the Project Explorer view (it may already be open) and delete the project from within there.
Go to Window >> Preferences >> General >> startup and shutdown >> workspace
theen select Recent work space then click Remove and close the program and open it again
You have to manually delete the project folder from your "workspace" directory (wherever you have defined it to be).
there will be a file .project xml file in the project and its content looks like
<projectDescription>
<name>ProjectName</name>
.
.
.
</projectDescription>
here ProjectName is the name of project you can change it to whatever you want.
First you create a project in some other location with the same name of your project as before.
Now delete this project by right clicking on project > Delete.
Do not check the dialog "Delete Project Contents on Disk".
Now you move your newly created project through file manager to the original location(location where you are not able to import your project).
Then import the project from the newly moved location(location where you are not able to import your project).
After deleting the project from Eclipse IDE(Project Explorer), remove it from work space folder as well. Workspace folder path - C:\Users\username\workspace (it can be different for your system).
try moving the project and try importing
go to tab window>preferences>search workspace> then make sure in last / is not in your recent workspace. Example-:/var/www/html
your url should like above.
With the same problem, I did a text search and found an XML file containing the name of the project.
I had copied the project from another project. Let's say that I copied project A to project B. Although the XML file in the new project (B) was named for project B, it had an entry which still referred to project A. When I edited it, the problem went away.
Simply remove the .classpath and .project files and try.
Go to create new project. Once there, select the project type. Mine was PHP project. The new PHP project screen will popup. There, click create a new project and give the project name which you used before. Then press finish.
If you need a 100% risk-free strategy, just right click the project and select 'export', and put it back where it was. Then, you can either continue using the project in your current directory (with no more popups) or switch over to the directory you were working in before. The side effect of the former is that you will have a duplicate project taking up a small amount of space. If anything, finish up what you need to do in the current directory, then pull (via git) from the original directory. Or, delete the project in the current directory, and import from the original directory to the target directory for the second time - though now, since it is the proper way, the issue will be resolved.
I met this problem just and I just figure out the main reason cause this problem is your copying pom.xml from another already existing project in your workspace.
So the way is find the pom.xml in your project folder and rename <name>conflicted Project name</name>.
In 2021, Using Ubuntu 20 here is simple way to remove it.
In Eclipse main Menu
Window -> Preferences
In the search type recent workspaces
Select and delete the project. click apply changes
Removing a project from an Eclipse workspace does not delete the files by default. You have to check a checkbox for that. This is a Good Thing. As you have not checked the checkbox, you have to delete the files manually using e.g. a file manager.
Note that there are files starting with . in an Eclipse project directory, such as .project. They are considered hidden files on Unices.
go to the folder and delete the file .project. This worked for me.

Eclipse: fully remove an old project?

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?
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).
Delete the project from /.metadata/.plugins/org.eclipse.core.resources/.projects and not the whole .metadata folder will save all other projects and config.
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.
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.
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.
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.)
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.
maybe you can try to delete the folders:
"/your_workspace/.metadata/.plugins/org.eclipse.core.resources"
"/your_workspace/ProjectName"
If the Project was in a working set before you deleted it, you might have to manually remove it from the set.
Instead of deleting any file, rename it, so if whatever you try doesn't work, you can revert.

Some projects cannot be imported because they already exist in the workspace error in Eclipse

I am trying to import a project that me and my co-worker have been working on.. and keep getting this error after I select-- "import" then "import existing project" then click archive file, and then I click next, and this error comes up:
Some projects cannot be imported because they already exist in the
workspace
Uncheck the "copy projects into workspace" checkbox, and then click "refresh" button, you will be able to import the project
go to .project file in your project and change the name of the project in name tag
It has just happened to me too. Finally I realized that the project was already open in my workspace but it was not visible because of the selected working set. You have just to deselect the active working set and all opened projects will become visible.
This usually happens when you change the project directory physically without first delete in Eclipse.
You can view and delete these hidden projects in the following view:
Window -> Show View -> Other -> General -> Navigator
Then simply just continue with the process of import existing project.
In my case, I copied one of the projects (say 'Project1') from the workspace and pasted it to the same workspace. After that I modified the name of the pasted project (say to 'Project2'). I could not see it in the repository.
The main reason was .project file from the new project still had:
<name>Project1</name> instead of <name>Project2</name>.
So, I did following things in order to get the issue fixed:
Cut and paste Project2 outside the workspace
Change .project file to have <name>Project2</name>
Try importing Project2 again.
It worked for me.
You may have a project with same name in your workspace. Try to refresh (file->refresh) your workspace after deleting the another one with same name.
A typical situation occurs when you want to re-import a deleted project.
Projects in the Eclipse workspace must be unique. Note though that the project name need not be the same as the directory/folder name of the project, so you can either delete any existing project with the same name or alternatively rename the existing projects.
You have one occult directory named ".metadata" in workspace directory. Close Eclipse, delete ".metadata" and open Eclipse. When eclipse ask you about workspace make sure that ".metadata" isn't in workspace directory and click "ok" button to select default workspace.
Maybe you get the same project name in your '.project' file,check it,if yes, rename another name.than import again
If you've arrived at this because you have cloned a git project into the existing workspace and now you want to promote that workspace to a full fledged project then you should use the 'Git Repositories' view -> select 'Working Directory' -> Import Projects -> Existing projects.
Check if you have configured Eclipse to show ALL the working set. I once encountered exactly the same problem and it turned out I accidentally imported the project into the Other Projects working set. And my Eclipse configuration didn't show that working set in the package explorer, which lead me to believe that the project was not imported yet.
Updated for #Mawg:
First, click the Select Working Set...:
Then, choose No Working Sets:
This will effectively disable the working set and show all projects.
Try to rename the value of <name> tag which inside ".project" file of your project.
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>Rename this value</name>
<comment></comment>
<projects>
This will work for sure. Here you are just renaming your project.
EASIEST WAY: Right click on the project (folder that reads "MainActivity") go to Refactor -> Rename and you will get a text field allowing you to rename your project.
If you get an alert saying your project is out of sync with the filesystem press F5 (refresh) and try again.
Take a look in your workspace folder, you may have an old project there with the same name as the one you are importing (even though it's not being shown on eclipse).
When you delete a project on Eclipse, if you don't check the checkbox on the dialog, it just removes it from the view and doesn't delete the folder on the workspace directory.
In my case i had deleted the resources directory from my .metadata.plugins:
Go to your workspace
Enter .metadata.plugins
Delete : org.eclipse.core.resources directory
Another way I just found!
MOVE the project to some other folder and then import and if required copy to workspace
I had this issue when I deleted a project and tried to import the code again. Eclipse never really deleted the project and still held a reference to the project name/folder in the workspace. I had to created a new project with the same name and my code appeared as it was. I believe this only worked because the project path was never changed.
It was happened to me when
I delete project from eclipse Project Explorer and not checked the
remove content from disk.
Next time when I tried to import same project in workspace then got same problem.
To solve I just did FYI work that every kid can do :)
So How I solved it:
Cut Ctrl + x myProject folder from eclipse workspace to other location ie Desktop
Right Click Navigator (you can get it from Window > Show View > Navigator) and Refresh (it will prompt following dialog)
Just click Yes button and move your project folder back to eclipse workspace directory
Import again!
Now Rock 'n' Role
This warning means you just deleted project from navigator, but the project is present in the working set. Or else your working set has project with same name, so go to work-space directory and delete the project which has the same name and import again.
This worked for me.
File > New > Android Project > Create project from existing source
Location = the location of the project you want to import.
You will get a warning "An Eclipse project already exists in this directory.
Consider using File > Import > Existing Project instead." But you will be able to click "Next" and the project should in effect be imported.
In eclipse click file then select switch workspace then browse and select another folder. Now repeat the same process and this time there will be no error :)
I had a similar problem, I have the same repository I wanted to import twice. I renamed the existing project by right clicking on the project > refactor > rename then imported it again.
My problem was a little bit different.
For example, the project name (what I see) was FooProject and in the imported project, I was looking for the FooProject but I could not. However, Eclipse does not let me import that project because he claims that it is already imported. And then, I have looked at the .project file of the project and I have seen that the actual name of the project was not what I see (FooProject).
The conclusion;
The name of the project (what you see in Eclipse) may be different than the actual name of the project (what maven see). Because of this reason. Please be sure that they are the same name by checking .project file of the project.
Nothing about could not solve my situation. This is how I solved.
Close the IDE
Remove the same name project form workspace
Start the IDE
Clean all project (not sure this helped)
File > Import > Existing Project
click refresh button
import project
Done..
At least on Eclipse Juno, you can toggle on Advanced. Then select [groupid].[artifactid] from the Name Template dropdown. That should make your project uniquely named. (If you keep multiple versions of a given artifact, you can select [groupid].[artifactid].[version] instead). Be sure to click the Refresh button so the changes are visible. Wash, rinse, repeat as needed.
delete it from eclipse......u might have closed the project in eclipse by "(Rightclick)-->close project".....so even if you delete this project from workspace folder....it stays there in eclipse IDE as closed project.....you should delete it from Eclipse IDE...!!!
I have a slightly different situation whereby my eclipse stops responding and I have had to kill the session. After restarting Juno, then the particular project I was working on disappeared although .project file exists. Trying to import back into Eclipse would yield the same "Some projects cannot be imported .." or "A project with this name already exists" if trying to create a new project.
In the end, since I was using Working Sets, I managed to find this file .metadata.plugins\org.eclipse.ui.workbench\workingsets.xml. Manually added the missing entry and restarted eclipse and voila, it came back.
I had the same error because there was one more project under svn in workspace but with another name. So I've removed it.
This is what i have noticed for the above issue :- If the checkout folder (folder where your pom project resides) is same as the eclipse workspace folder then i am getting this issue
SOLUTION
when i used a separate workspace folder for importing the project, eclipse did worked smoothly :)
In case you are using Maven, make sure that your artifactId in pom.xml does not have the same name as any existing project name in your Eclipse project explorer.

"Sources directory is already netbeans project" error when opening a project from existing sources

I've installed NetBeans 6.9.1 and installed few updates for it.
Then I've created a new project from existing sources. After a few changes I've closed it. And now I am having an error, when trying to open a new project from existing sources (the same files):
Sources directory is already netbeans project (maybe only in memory).
After Googling it, I noticed it happened not only with me. But I didn't find the correct solution. I've tried to restart the IDE, I've tried to restart the PC, I've tried to reinstall NetBeans. Nothing helped.
Thank you!
I was having the same problem:
Sources directory is already NetBeans project (maybe only in memory).
Netbeans creates a folder in your project named "nbproject". Once you delete that, restart the IDE and you're good to go.
When you create a NetBeans project from existing sources, NetBeans uses the same directory to add its own files: a netbeans folder with .proj files.
Solution: delete the netbeans folder and restart the IDE. Opening a new project should now work.
Go to the folder containing your project
Delete the folder named nbproject
Restart Netbeans
Try creating your project again from the original folder
This means the project folder is already a netbeans project. So instead of adding it as a new project open it as
This happens(i believe) because netbeans tries to version control the files created or edited.
Under the project folder netbeans create a netbeans directory just delete it . This has been tested in Ubuntu. Then you can import your project if php then php using existing sources.
Click File >> Recent Projects > and you should be able to use edit it again. Hope it helps :)
On Windows at least none of these answers work (for me anyway!). I have found the only way is to copy an existing netbeans project folder in to your new project and manually edit the xml project name.
I also opened the private/private.xml and removed the open files xml just incase these caused problems.
Once I'd done this the project works as normal.
I checked the "Put NetBeans metadata in separate directory" tick and it works fine.
This is in 2. Name and Location after you choose PHP from existing source
In my case my project root directory consists ".project". This contain the XML reference of the project name.
By removing this, i am able to create a project.
Usually this happened when we copy source code of a already created project and copied in different folder and try to create a project from it. as netBeans create its folder nbproject in our project folder this folder also get copied with our source code and it give error "Sources directory is already NetBeans project (maybe only in memory)" remove this folder from you newly copied folder and voila you can create a new project.
If this is your own source code and you already have a Netbeans project folder with your source files you should just start with:
File | Open Project...
not
File | New Project ...
because the project is not new.
If it helps anyone else, I had the same problem and the solution was to reinstall NetBeans.
I had tried all sorts of fixes: Deleting the NetBeansProjects folders, checking/unchecking "Put Netbeans metadata in a separate directory", killing/restarting NetBeans, restarting the system, etc. Nothing cleared the message...except the reinstall.
The advice here about removing the nbproject directory is not quite the whole story.
What Netbeans seems to do (and we are guessing at reverse engineering here) is to look for an xml file which has opening and closing project tags in it. This it concludes is evidence of an already existing project. Now if your files have an nbproject directory there, that will contain a project.xml file which contains the said tags. So removing that will do what you want.
But, my files don't have a nbproject directory but still NetBeans tells me there is an existing project maybe in memory. The reason is: my files include a file called pom.xml and that contains the said project tags in the xml (it was created by an entirely different system). Once that xml file is removed, then NetBeans will create an html project for me importing my code.
In sum: look through any xml files in you existing code, and be wary of project tags.
This happened to me when I tried to import an Eclipse project in a brand new NetBeans 7.2.1 install on Ubuntu 12.04LTS.
I mistakenly selected the import projects from workspace (the first option in the import wizard's opening pane) on the first attempt, and it opened the project in the original Eclipse workspace path (which was on a usb stick).
From this, I then realized that I actually need the second option - import project ignoring project dependencies, which lets you specifically choose source and destination folders. After closing the project, I tried to import again with the proper option, but it didn't work.
From then on nothing I did helped - restart the IDE, move the source folder, nothing. There was no nbproject folder in the project or /var/cache in the user folder to delete (in-fact there was no nbproject folder in the whole file-system).
Since restart didn't work, I'm guessing that there is a garbage project entry somewhere which Nb reads (See Martin Frické answer above).
After googling along the lines of 'netbeans clear memory project cache' with no success, I opted to reinstall NetBeans -
sudo /usr/local/netbeans-7.2.1/uninstall
sudo ./netbeans-7.2.1-ml-javase-linux.sh
which solved it.
If you are on a Mac, press command shift G and in the box type /users and then go, next click on your user name and navigate to netbeansprojects and open it. Then delete the ones in there that are causing problems. You can then create your project.
Note: I had moved my wordpress folder to my desktop trying to figure this out, so I dropped it back into the origional location and it works fine. So if you did this, just replace the wordpress folder after deleting the problem projects from the netbeansprojects folder and its contents back to the original installation folder.
Hope this helps...:)
This is what I did to solve this error:
1) I copied a folder named "folder1" (and I called the new folder "folder2"). "folder1" was a Netbeans project so it had a folder called "nbproject" inside it.
2) When I tried to create a project out of the "folder2", Netbeans threw an error "Sources directory is already netbeans project (maybe only in memory)."
3) Inside Netbeans delete the project of "folder1". Then, delete the two folders named "nbproject" (one is inside "folder1" and the other is inside "folder2").
4) Inside Netbeans, create two new projects: one for "folder1" and another for "folder2". The error should not appear anymore.
copy an existing netbeans project folder in to your new project and manually edit the xml project name.
reinstall netbeans
copy/move all files/folders (except nbproject/ folder) to a new folder for your project, with a new name.
Try to create a new empty project; then you can copy the public_html to the new project folder and it will appear .
I faced the same issue:
Sources directory is already NetBeans project (maybe only in memory).
The solution is:
Netbeans creates a folder in your project named "nbproject". Once you
delete that, restart the IDE and you're good to go.

Retrieve/Recover deleted Netbeans project

I was just working on my Netbeans project and accidentally deleted it and don't know how to recover it.
Is there a tmp folder that the deleted project is stored in.
Or am I forever doomed?
Thanks,
Lucas
Do not panic. Its very easy. Follow the steps:
Right click on the folder/directory that the files had been deleted.
Choose Local History – Restore Deleted
Done
If you accidentally delete a folder on Netbean, the way to recover it is as follows. You can't revert deleted folders but you can revert deleted files. Follow these steps.
Recreate the folder you deleted in your Netbean project. (You may not be able to create the folder within Netbean, in that case you can use mkdir command to create the folder )
Right click that folder in Netbeans and go to History -> revert deleted (you should see a list of deleted files that relate to that particular folder.
Repeat for each folder and sub-folder
Note: I do not know if this works on windows, I know it worked for me on Linux. I also don't know if this works after you have closed Netbeans.
hope it helps someone.
You have a problem of package/directory/file deleted in netbeans?
Don't panic it is simple just:
open your netbeans IDE
go to projects
go to the package where your project folder was
right click on it
go to local history, then go to revert deleted
it is done. Wait a moment!
I think it will help you.
Enjoy your code please.
http://www.recuva.com/
saved me countless times when I first started with Visual C# opening the IDE and making mini programs without saving. All your files are stored in a temporary folder and exiting Visual C# wipes them. Just do a recuva scan and sort files found by modification time. Deleted files are recoverable, overwritten files however are a different story, so run the program as soon as possible.
Actually, easier then trying to load a project that does not exist in the project explorer of netbeans.
If you still have the files locally, just choose Open Project and your lost project will be restored to the Project explorer of netbeans.
I don't know if there is a temp folder. Windows search engine doesn't work to find it. If you delete the source file by using safely delete;
On Netbeans Refactor-Undo[Safely Delete] option can be used to recover...