Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to move an eclipse (helios) project to a different workspace?

Tags:

eclipse

helios

First, Eclipse is not my native IDE -- I'm barely a n00b with it. I set up a project in a workspace that was actually in the directory of another client's project (I didn't really follow the whole workspace/project thing) and, in fact, now I can't even find the Eclipse workspace file to open it.

What I'd like to do is:

  • Open my eclipse project (/workspace?) -- I know where all the files are on disk, just not what to open in order to see them in Eclipse -- and

  • Move my project to a new workspace, which I guess I will put in a generic Eclipse-y place, and have that one workspace reference all my Eclipse projects.

(Is that the right way to do it? Does Eclipse dislike me being a one-project == one-workspace kind of guy?)

Please educate me regarding The Eclipse Way so that I can get back to work writing code.

Thanks!

like image 941
Olie Avatar asked Aug 24 '11 18:08

Olie


People also ask

Can I move my Eclipse workspace?

The best way is to close Eclipse and physically only move the hidden . metadata directory to where you want it to be. That way only your workspace is migrated leaving your projects at their original locations. However, your method is OK if you are fine with migrating your projects with the workspace.


2 Answers

Roughly a workspace (which is a directory) in Eclipse contains:

  • configuration (installed JRE, Servers runtimes, code formatting rules, ...)
  • one or more projects

You can of course have as many workspaces as you want (but only one can be opened at a time) and a project can also be part of different workspaces.

If you know where your sources are and want to move them to a new workspace here is a possible solution:

  • Start Eclipse and when prompted for a workspace choose where you want the workspace to be created (if directory doesn't exist it will be created). For example you can choose C:/Dev/Workspace/.
  • If you are not prompted, go to File->Switch workspace->Other
  • Once you are in your workspace you can import your exisiting project with File->Import then General->Existing Projects into workspace
  • Navigate to the folder containing your project sources, select your project and click finish

I don't know if it's a best practice or not but what I usually do is the following:

  • I have one workspace for each of my customer (workspace_cust1, workspace_cust2)
  • Each workspace references my commons library projects and add client specific projects

This way each time I change my commons library it's up to date in every workspace.

like image 147
Davz Avatar answered Sep 17 '22 19:09

Davz


If you want to apply

one workspace = one project

You could to the following:
1) Copy the eclipse desktop shorcut
2) Modify the shortcut by appending "-data workspaceLocation "

like image 26
VirtualTroll Avatar answered Sep 17 '22 19:09

VirtualTroll