user
user

Reputation: 6947

Eclipse: Multiple projects with same name but different location

I have two copies of the same directory structure (basically, trunk and a feature branch) which both contain a Java project (call it ProjectX) in a subdirectory of the respective base directory.

I have painstakenly set up Eclipse the way I want it to work with regards to settings, colors etc.

Now, I want to be able to switch between working in either trunk\ProjectX or featurebranch\ProjectX. These are completely separate on disk (which is why I feel that the accepted answer to How to create multiple projects with same name in Eclipse? does not address my concern), but since they share the name ProjectX on disk, Eclipse doesn't seem to want to let me add them to the same workspace.

Working sets don't help me because the projects are not (yet) in the same workspace.

Removing and re-adding the projects very quickly becomes error-prone.

Making a copy of the workspace directory and opening that seemed to lose quite a few of my settings (colors, servers, etc.) (why that is is another interesting question) and as far as I could tell, there was no easy way to tell which workspace I am actually working in right now.

My question: What is the recommended way to deal with a situation like this?

I guess I am hoping for some way to define an alias of some kind, such that I can add trunk\ProjectX as TrunkProjectX and featurebranch\ProjectX as FbProjectX, then use working sets to switch between them.

Upvotes: 20

Views: 16581

Answers (4)

Selva
Selva

Reputation: 597

For maven projects, that have same name use Advanced->Name templates (I prefer groupId.artifactId) while importing them into the same workspace

For eclipse projects, edit .project file and change <name> under <projectDescription>

Upvotes: 2

Raedwald
Raedwald

Reputation: 48634

The project name is just a string in the .project file, so you could edit the file outside Eclipse before opening the project in Eclipse.

Upvotes: 0

TheWestIsThe...
TheWestIsThe...

Reputation: 442

I've used the following process, and it's worked for me:

Import both projects using the following steps:

  • Choose "File | Import" from the menus
  • Choose "Existing [Project Type] into Workspace", where [Project Type] is the type of project you're importing (e.g. Android)
  • Choose "Next"
  • Browse for your Project folder using the "Browse..." button
  • Before clicking "Next" or "Finish", change the "New Project Name" field entry to a unique name.

Upvotes: 1

oers
oers

Reputation: 18704

Eclipse has a showlocation parameter:

eclipse.exe -showlocation

This will show the location of the workspace in the title bar.

I use an extra workspace for each branch. That way I feel secure, that I don't accidentally forget something and change trunk instead of branch.

Upvotes: 7

Related Questions