tags:

views:

429

answers:

3

In VS, it's simple. Everything the project needs is stored in the project folder and all VS settings are stored in one place. Eclipse, however, stores Eclipse settings with the project and keeps a .metadata at the workspace level which is needed to detect the projects in the workspace. Thus, I can't simply branch a project and then open it in Eclipse. I need to set up a workspace, branch it into that workspace, copy over all my workspace settings (settings import/export doesn't even work right in Eclipse) so I have the same Eclipse settings, then do some kind of import to get the project in the workspace. This is what I generally refer to as a pain in the freaking neck, and it causes me to not branch any Java projects and to keep them all in one folder. This is also a pain.

Is there any way I can get a setup where I can just branch a project and open it in Eclipse, while maintaining the same Eclipse settings?

UPDATE: The current state of the question is expressed by the comment to soru's post.

+1  A: 

Well, I'm not a fan of keeping any IDE specific settings in the repo, but when I do I keep only .project, .classpath and .settings.

You can also keep you settings at the workspace level (Windows->Preferences),and not on the project level (Project->Properties).

Also why do you create a seperate workspace for branches? You can keep it in one workspace, no need to create another one.

You could also use "switch" in subversion (I don't know if that's what you are using, but other revision systems should have something similar) and go to the branch you have created. (of course if you wan to work concurrently on more than one branch then it doesn't help)

krzyk
Let's go through a concrete example, because I'm not sure we're on the same page. Assuming I'm hacking on 30 different Java projects. I would like to keep these all in completely separate folders (and not have to keep them under a workspace parent folder), in completely separate repositories (of a DVCS), and be able to branch them at will, possibly to another device (I go from network share copy to local copy), then immediately open them in Eclipse and get the exact same Eclipse settings every time I do so. Can I do this? How?
Daniel Straight
It turns out keeping the .classpath and .project files is important for being able to do what I want. Thanks for the tip.
Daniel Straight
A: 

I can't speak to the Eclispe problem, as i'm only a n00b user, but I can speak to the secondary question.

I've been working in systems for a number of years that ended up needing to have various branches of the same code done for a variety of reasons.

One of the best reasons for keeping specific settings in project-specific locations is that so the various compiler / sdk / etc. settings & files can be specific per-branch and not collide between branches.

This allows, for example, for the work to upgrade a code set to a newer sdk/compiler to be done without impacting the ability to work on the existing "main line" code set with the previous sdk/compiler should the need arise.

In my experience in the computer game industry as a core technology wog, this happens a LOT.

I'm sure the same situations occur outside the computer game industry, maybe just not at the same pace.

ted_j
+1  A: 

Pretty sure you want to:

  • Keep the same workspace for all projects (or maybe a few, at the level of say 'hobby' and 'work').
  • switch between different branches in the same project by using the features of your version control tool/plugin
  • if you want to work on multiple branches at the same time, just create two projects, and manage them both as above.
  • if you want to temporarily hide the inactive version, use the 'working set' feature.

The main limitation is that you might want to have projects with the same name, but you can't. So sometimes you have to make up a project name different from the underlying folder name.

In general, mapping between VS and Eclipse:

  • Installation <-> workspace
  • Solution <-> working set
  • Project <-> project or folder or VC system branch or working set node

Refs:

VS object model

using working sets in Eclipse

working with branches in subclipe

soru
This is better, but it's still somewhat a pain. Since Eclipse doesn't force projects to be in the workspace folder, I can maintain a project across different devices. I can use working sets to make Solutions, but I have to use a somewhat elaborate naming scheme in order to avoid project name collisions. Something like, device_solution_branch, which is a pain but doable. I still have to manually "Create a project from existing sources" each time I create a new branch in my version control and manually keep the proejcts in sync with the branches. Any ideas for improving this?
Daniel Straight
That kind of depends on your version control system, your plugin, and and how you use it. What you want is a setup something likedev.myproj -> <my proj repository>/trunkstable.myproj -> <my proj repository>/tag/4.3.2And you change that setup, depending on what you are doing, using the VC ('Team') plugin. In (e.g.) subclipse, this is 'Team/Switch to another Branch/Tag...'
soru
Right now I'm using bzr without any Eclipse integration.
Daniel Straight
There is a bzr plugin for eclipse (http://bazaar-vcs.org/BzrEclipse), but I can't say if it is any good or not.
soru