Frage

I use Eclipse for Java (mostly Android) development with my work is split into a variety of projects which interlink in a variety of ways (mostly Android libraries, some pure Java stuff).

When it comes to Source Control, I want to keep groups of Projects in single repositories. This is mainly because I don't want to have dozens of repositories, just because I have dozens of projects!!

MercurialEclipse is hopeless for this - it will only work on a 1:1 basis between Project and Repositories - so that's out.

EGit seemed promising, there are a number of articles (here and elsewhere) which demonstrate how to put many projects into a single .git repo - and I managed to get this part of it working after a mere 3 hours of head-on-desk moments!!

It's shaky-as-hell tho - commits seems a potluck affair (first attempt always seems to fail - 2nd usually works!?).

Worse still are the problems with Android libraries tho - Eclipse thinks they exist - but then they don't - then they do - then they don't! Changes to Project Properties sometimes won't save (never a problem before I 'source controlled' the project) and so I'm giving up on EGit completely.

So - are there any other options I've missed or do I have to actually run source control from outside Eclipse!?

War es hilfreich?

Lösung

OK - I've spent a bit of time with this and I've found what I think is a decent compromise using MercurialEclipse.

It relies on setting-up version-control outside of Eclipse - but once you've done that, you can work within Eclipse (using MercurialEclipse) for changes/commits/pushes.

First job is to remove the projects from the Eclipse Workspace (but NOT the filesystem).

I then move all the projects I want to group together into a subfolder within the workspace like this

WORKSPACE
    MYREPOFOLDER
        PROJECT1
        PROJECT2
        ...

I then use a tool (in this case TortoiseHG) to create a repository in the MYREPOFOLDER folder. I actually clone a BitBucket Repository but whatever works for you...

Still using TortoiseHG, I add the PROJECT1, PROJECT2 folders into that repository and do a 'FIRST COMMIT' on them.

Then, in Eclipse I use the Import->Mercurial tool to import some or all of the projects from that Repository. MercurialEclipse is smart enough to find projects even tho they're not in the 'root' of the repository and will commit and push changes AOK (well, as far as I've tested it!!).

So there you have it - one repo with multiple projects and only a bit of work outside Eclipse to make it work - I hope this helps someone!

Andere Tipps

As far as I know, you have to run source control outside of Eclipse if you are managing the whole workspace as a whole. Eclipse will only look for changes inside projects in its workspace, not the workspace metadata and other folders that are not projects.

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top