I am not that used to changing workspaces in Eclipse, in fact, I only have one workspace. But right now, there is a need to change workspace and organize different projects but I don't know how to do it.
I saw something about refactoring and simply importing projects but I don't want the outcome of that.
Currently, I have C:\Users\krato\workspace\ as my default workspace and I want to create another in D:\dev\. So I created one using File > Switch workspace > other > D:\dev\. And in that workspace I imported some projects from the prevoius workspace. Yes I already see the projects in the dev workspace but when I open the other workspace (C:) I still see the imported projects and the folder (C:...\workspace) still contains the projects. What I want to do is to transfer the projects in a different workspace and in a different folder, which in my case D:\dev.
I tried to refactor but it says that it overlaps with the workspace location.
Please suggest the best way to do this.
I would also like to ask your recommendations whether I should have a same workspace and projects folder (like what I want to do) or different directories for my workspace and projects folder.
Your project folders don't need to be where your Eclipse workspace is. In fact, I would recommend to keep them separate:
Your project folders contain the project's code, together with Eclipse .project and .classpath files.
Your workspace on the other side contains Eclipse settings for working with your projects. It can contain multiple projects, and a project can be contained in multiple workspaces.
In your example, I would recommend to manually copy or move your code to D:\Dev, create a new workspace in C:\Users\krato, e.g. C:\Users\krato\workspace-dev, and then import your projects there using Import existing projects.
I would recommend moving rather than copying. If you really need a second copy of your project, consider using a version control system such as git and create a branch instead.
To achieve what you want, you need to do the following:
Create a new Eclipse workspace (like you have done already)
Import the projects you want to move using File/Import/General/Existing Projects and select the check box "copy projects into workspace"
Delete the now copied projects from the original workspace in Eclipse and select the check box "delete project contents on disk"
After that you will have completely moved the projects from one workspace to another, including the underlying folders.
I would also like to ask your recommendations whether I should have a same workspace and projects folder(like what I want to do) or different directories for my workspace and projects folder.
It depends on your own preferences and, how the projects are going to be used. I prefer to have my main project folders separate from my workspaces, because some of them will reside on either SVN, GIT or also Dropbox. Especially library projects, that might be used by more than one other projects, are better kept in a separate workspace and/or folder. This allows one to keep the overview and one can simply include these library projects in other workspaces when needed.
If you didn't delete the projects from the first workspace, they will still be there. Did you copy the files from C: to D: or move them? If you copied them to D: and you don't want them on C:, delete them from C:. But make sure they really are on D: first.
Or am I totally misinterpreting your question?
I believe I had a related problem, and conquered it.
I needed to move my entire workspace (containing my project directories) to a different drive, on Windows. If one wanted to move only some projects, and keep the old workspace as well, this could be modified simply by deleting projects as desired.
On http://www.eclipse.org/forums/index.php/t/248863/
nwbeeson had written:
Thank you. Here is exactly how to do this from a friend who is an
Eclipse expert.
1. Open Eclipse and switch to Workspace1 using Switch To Workspace...
2. Check the projects in Workspace1
3. Switch to another workspace to make sure that Workspace1 is closed completely by Eclipse (Critical step!)
4. Quit Eclipse
5. Copy Workspace1 and name the copy Workspace2
6. Copy Workspace2 to a USB flash drive
7. Copy Workspace2 from the USB flash drive onto the hard disk of a different computer
8. Open Eclipse on the new computer
9. Switch to Workspace2 using Switch To Workspace...
The projects open normally from Eclipse on any machine as though that
workspace had been there all along. The critical step seems to be
switching to another workspace before quitting Eclipse. If you skip
that step the copied and transferred workspace does not open
correctly.
This worked perfectly. Without the critical step, Eclipse balked at the new workspace location. All sorts of references to old paths are used, and apparently updated only if the workspace was fully doubly hyperbolically closed prior to the copying of the workspace to a new location.
Related
I am using eclipse and I moved some projects(Projects with the name Mc Bot) in my workspace to another folder. However, when I open eclipse with my workspace, projects still appear like this in package explorer.
How can I fix that?
You cannot move project folders on your hard drive and expect Eclipse to update automatically. The folders contain metafiles that Eclipse needs to properly load the workspace on startup.
It is better to either rename/move the projects within Eclipse.
Or to remove and then re-add them to Eclipse's project management.
However, make sure to not accidentally delete the files from disk, when removing the old project from Eclipse. There is a checkbox within the confirmation dialog that - in this case - you should not check.
Especially when you are working with a code versioning system (such as Git or SVN), it is important to rename your files and folders within the code editor. Otherwise your repository might get out of sync.
I would just delete it here in eclipse (don't mark the checkbox to delete on disk) and then reimport it. So in this view from the screenshot just open the context-menu, say import and chose your projects again.
To work seamlessly on different Windows 10 devices, I added an Eclipse workspace to OneDrive (OneDrive/Eclipse). The contents of this folder are my projects, and a .metadata (~45MB) folder, and a (hidden?) .recommenders (~5MB) folder.
Because all of this is inside OneDrive, all files and projects get synced between devices. If I come home from work, the projects will sync to my home computer, but so will the .metadata and .recommenders folders.
The problem is that OneDrive often runs into issues: something cannot be synced or overwritten, so it creates a local copy - which is obviously annoying. Upon closer inspections I realised I don't even know what .metadata and .recommenders are, or what they do.
Should these folders be device specific and should hence not be syncronised between devices OR are they workspace specific and are they required to be in sync?
What do these folders actually contain? When going through some files I see a lot of folders, plug-ins, and preferences but I don't get what they are for.
To what extend do you want it to be seamless? Including workspace settings or not?
.recommenders should contain information about dynamic ctrl-space completion based on the user's past behavior etc. Probably not needed for a seamless experience unless you care about details.
.metadata is all the workspace settings & cache & essentially the workspace's home directory. It contains all sorts of things: What is the .metadata folder in Eclipse workspace? Not super important to sync if you enable per project settings instead of workspace settings. But maybe needed for whatever your definition of seamless is. There is lots of caching and other things in there that isn't useful to sync and can cause odd effects so I would rather avoid the entire folder.
I got a new laptop and copied all my eclipse stuff from my old laptop to new one.
It was actually the same laptop model just upgraded a few things (mem, drive size, etc)
So the drive letters are the same as the old laptop.
When i originally opened eclipse i got an error message and read on this site to delete the "org.eclipse.core.resources" folder in .metedata/.plugins folder.
So that go eclipse to open.
After opening i dont see any of my projects even though the workspace is already set correctly.
So i tried importing android project and eclipse project but i get errors saying the packages are already there. even though i dont see them in the project explorer.
Whats the easiest way to get my projects back?
If you want your projects on your workspace again, you can go on File -> Import. It will open a modal, then you select General -> Existing Projects In Workspace. Now just select your root directory and it will list all of your projects to be imported.
One important thing is that this method does not import things like Working Sets. If you had your workspace customized, it won't bring any of these customizations back. Still, it is better have your projects back than nothing.
EDIT:
As it didn't work, you also can delete the .metadata folder and it will be like you never had this workspace. After that, you can try to import the projects again.
My directory structure in the Project seems to have disappeared. The first picture is the "bad". I recently upgraded to 12.1 and the vim emulator at about the same time. I don't know if I missed a dialog that reset something? I can't figure out how to get it back like the second picture.
I've tried to re-import the project but it has not helped. I keep the project on Dropbox and have another PC where I have not reloaded project. Is there a way to get my view from that machine?
The picture is the "good" and how I want it to look.
I've come across this problem a few times myself. What happened is that intellij lost the module in my project settings. Here's my steps to fix it:
File -> Project Structure -> Click on modules (notice empty list) ->
Click on '+' -> Click on import module -> Find existing myProj.iml
I also have quite a few IntelliJ projects and also git folders of text files. I found IntelliJ does not always reconstruct the .idea files correctly. However the following methods work for me.
Open IntelliJ in the top folder where there is no .idea folder. Often IntelliJ will just construct a new .idea folder and works.
Copy an .idea folder from a similar project and modify to fit. The xml files in the .idea are reasonable to modify.
Open IntelliJ in the root project level works for me.
I have a mixed project folder tree like the following:
git_root
- proj_android
- proj_ios
- proj_react
- lib
- src
My problem is that when I open IntelliJ on my proj_react folder, I could not see my src folder or lib folder. (My proj_react is one level down from my git_root.)
Then I open IntelliJ on git_root, I could see everything. The problem is solved.
If you are working on a software development project where you are using Maven, Gradle, Flash Builder etc., the below mentioned steps should restore the project structure:
Ctrl+Alt+Shift+S (or) File>>Project Structure
Select 'Modules' in 'Project Settings'
Alt+Insert (or) Select '+' to add a new module
Select 'Import Module'
Select the folder you want to import the module from(Generally the parent folder)
Select 'Import module from external model' and the corresponding external model
This resets your project structure.
You can sometimes rescue projects like these by going and resetting their content root in the module settings. Or even recreate the module as another answer suggests.
This is something that would happen to me if I opened an IntelliJ project in PhPStorm, then tried to open it in IntelliJ again.
However as was mentioned the project format changed recently, so you should use the same version of intelliJ to work on your project.
If you have a content root for a project module that intersects with another content root, then this problem will occur. For example:
Project A (content root)
- source for A
- module B (content root)
- source for B
If you have a project that has a source root for "Project A" and you add a source root for "module B" you will end up with missing structure, such as your first picture. This happens because the content root for module B is within project A structure.
This worked at one time, as I have the setup above with multiple modules. When I upgraded to 12.1.6 this stopped working. If you have overlapping source roots you will see this problem.
I'm using 12.1.6 on windows 7.
On Mac:
Preferences
search for Project Structure or go directly to:
Project: Your_Project_Name / Project Structure
Mark all as Sources (mine was marked as "Excluded")
What did you update from? If you did a few major versions update, intellij really changed how their projects are laid out. You probably need to edit the projuct structure and add a new java module.
This issue is 8 years old and the problem still exists in IntelliJ. For projects with many modules, it can be a real pain reconstructing them after each time this occurs. I suggest that once you reconstruct the modules, back up the .idea folder so you can easily restore it next time
In the bottom left corner of IntellIJ you'll find an icon, using which you can fetch project structure, etc..,
This is the quick fix that i have done:
Close the IDE and open the project folder in file manager
Delete the .idea folder and reopen the project in IDE.
To view the hidden folder and files:
Open the folder and press cntrl+H (in linux), And in windows Go to folder options and check view hidden files option.
I have been working on a project locally and at some point I gave the project to someone else to work on.
Since that time, I have created another package with classes and so on in my own project version. Since I want the other person to have this package, I gave him the package folder which he copied in the path ProjectName/src/packageName.
Of course, he didn't see it right away, so I used New->Source Folder and refresh/clean/pray to make it work.
The question is: is there some other way to add packages to projects? as I'm not sure this is the right solution.
A refresh is sufficient after you have dropped the new source files inside the source folder. No need to add a new source folder.
The clean way to collaborate is to use a version control system, like Subversion, git, or whatever. Copying files between developers is a recipe for chaos.
From backend, Go to ProjectName/src and copy/paste all the package, and then right click and select "Refresh".
Simply dropping in the files and refreshing is sufficient. Eclipse will automatically ammend the package declaration in the Java sources.
That all being said, you should be looking at using a version control system such as CVS or subversion for example.
Copy the folder at desired location.
Refresh the project in eclipse. It will be visible now.
Right click on the folder in eclipse under project explorer. Select Build path>Use as source folder.