Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Eclipse Workspace/Project Setup Using Symlinks

I have the following simplified setup:

~/Development/Repositories/ProjectA-trunk
~/Development/Repositories/ProjectA-branch
~/Development/workspace
~/Development/workspace/ProjectA

ProjectA is a symlink to ../Repositories/ProjectA-trunk. In an ideal world I'd be able to switch the link to point at ../Repositories/ProjectA-branch and then go refresh the project in Eclipse and be working on the branch.

In this unfortunate real world Eclipse, even though it says otherwise when importing the existing project initially, resolves the symlink and keeps the absolute path to the project in Properties>Resource>Location for "ProjectA", which is in this case ~/Development/Repositories/ProjectA-trunk. Therefore switching the symlink has no effect because Eclipse now thinks ProjectA lives at ~/Development/Repositories/ProjectA-trunk and not ~/Development/Repositories/ProjectA.

Does anybody have a solution or workaround or suggestion on how to set up your workspace to make working with branches like this work?

like image 436
Kevin Herron Avatar asked Feb 16 '11 01:02

Kevin Herron


People also ask

How to Link file in Java Eclipse?

For Java, you can right click on the project and go to Properties then into Java Build Path . Under the Source tab you can click on the Link Source...

How do I link a source in eclipse?

open the project properties tab (right mouse click → properties) select the 'Java build path' option and choose the 'source' tab. press 'Link Source' and browse to the 'main/java' subfolder of the Maven project. Close the project properties.


1 Answers

To import the project initially (assuming ~/Development/workspace/ProjectA does not currently exist):

  1. mv ~/Development/Repositories/ProjectA-trunk ~/Development/workspace/ProjectA
  2. Import ~/Development/workspace/ProjectA into Eclipse
  3. mv ~/Development/workspace/ProjectA ~/Development/Repositories/ProjectA-trunk
  4. ln -s ~/Development/Repositories/ProjectA-trunk ~/Development/workspace/ProjectA
  5. Refresh Eclipse

Whenever you want to change the branch:

  1. ln -Tfs $BRANCH ~/Development/workspace/ProjectA
  2. Refresh Eclipse
like image 63
Max Nanasy Avatar answered Oct 17 '22 19:10

Max Nanasy