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

Olie picture Olie · Aug 24, 2011 · Viewed 26k times · Source

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!

Answer

Davz picture Davz · Aug 24, 2011

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.