Eclipse 多项目/单存储库源代码控制选项

发布于 2024-12-11 06:00:53 字数 565 浏览 0 评论 0原文

我使用 Eclipse 进行 Java(主要是 Android)开发,我的工作被分成各种项目,这些项目以各种方式相互链接(主要是 Android 库,一些纯 Java 的东西)。

当谈到源代码控制时,我想将项目组保留在单个存储库中。这主要是因为我不想有几十个存储库,只是因为我有几十个项目!

MercurialEclipse 对此没有希望 - 它只能在项目和存储库之间以 1:1 的方式工作 - 所以这是不可能的。

EGit 看起来很有前途,有很多文章(这里和其他地方)演示了如何将许多项目放入一个 .git 存储库中 - 我在仅仅 3 小时的工作后就成功地让这部分工作了瞬间!!

它是摇摇欲坠的地狱 - 提交似乎是一件聚餐事件(第一次尝试似乎总是失败 - 第二次通常有效!?)。

更糟糕的是 Android 库的问题 - Eclipse 认为它们存在 - 但后来它们不存在 - 然后它们存在 - 然后它们不存在!对项目属性的更改有时不会保存(在我对项目进行“源控制”之前从来都不是问题),因此我完全放弃了 EGit。

那么 - 是否还有其他我错过的选项,或者我是否必须从 Eclipse 外部实际运行源代码控制!?

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!?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

柳若烟 2024-12-18 06:00:53

好的 - 我花了一些时间来解决这个问题,并且我发现使用 MercurialEclipse 是一个不错的折衷方案。

它依赖于在 Eclipse 外部设置版本控制 - 但一旦完成此操作,您就可以在 Eclipse 中(使用 MercurialEclipse)进行更改/提交/推送。

第一项工作是从 Eclipse 工作区中删除项目(但不是文件系统)。

然后,我将想要分组的所有项目移动到工作区中的子文件夹中,如下所示,

WORKSPACE
    MYREPOFOLDER
        PROJECT1
        PROJECT2
        ...

然后使用工具(在本例中为 TortoiseHG)在 MYREPOFOLDER 文件夹中创建存储库。我实际上克隆了一个 BitBucket 存储库,但无论什么对你有用......

仍然使用 TortoiseHG,我将 PROJECT1、PROJECT2 文件夹添加到该存储库中,并对它们执行“首次提交”。

然后,在 Eclipse 中,我使用 Import->Mercurial 工具从该存储库导入部分或全部项目。 MercurialEclipse 足够聪明,可以找到项目,即使它们不在存储库的“根”中,并且会提交并推送更改 AOK(好吧,据我测试过!!)。

现在您已经有了它 - 一个包含多个项目的存储库,只需在 Eclipse 之外进行一些工作即可使其工作 - 我希望这对某人有帮助!

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!

墨小沫ゞ 2024-12-18 06:00:53

据我所知,如果您要管理整个工作区,则必须在 Eclipse 外部运行源代码控制。 Eclipse 将仅查找其工作区中项目内部的更改,而不是工作区元数据和其他非项目文件夹。

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文