日食、蚂蚁和Mercurial 具有多个(子)项目

发布于 2024-11-10 03:21:51 字数 1054 浏览 0 评论 0原文

我知道,还有一个多项目问题。我已经看到了我的目标子集的(相互冲突的)答案,但没有一个能涵盖全部。 我是 eclipse 新手,不知道 hg 的肮脏细节。

给定一个通用的库 jar、两个应用程序和一些通用的 ant 脚本...

我会设置这个

/top/
    build-common/
    lib1/
    app1/
    app2/

我读过 eclipse 不执行子项目,所以我认为这将是 4 个 eclipse 项目,而“top”没什么意义蚀。

我已经阅读了如何使用 ant 进行 Eclipse 构建,包括自动构建。

  • 3 个 java 项目在其 build.xml 中引用 ../build-common/{scripts} 是一个好习惯吗? (当这是一个不同的 Eclipse 项目时)
  • app1 和 app2 应该引用 ../lib1/target/lib.jar 吗?如何?
  • 如果 ant 正在进行 eclipse 构建,我是否仍然维护 .classpath(通过任何 gui)?
  • 我假设 Eclipse 用户不会期望自动构建来传播项目。正确的?

我不清楚 4 个 eclipse 项目是否会强制 4 个 Mercurial 项目。 如果 Mercurialeclipse 插件支持它,我可以将其作为一个 hg 项目(“top”)。但我不确定优点和缺点。 Team->Commit 可能会影响其他 Eclipse 项目——这对于 Eclipse 用户来说会是错误的吗?

  • 那么,4 个或 1 个汞项目?

在 Eclipse 之前,我通常会有一个用于构建子项目的顶级 build.xml。即使 eclipse 构建不需要它,我也想支持完整的命令行构建。

  • 顶级 build.xml 会去哪里?

另外,我怀疑您的代码实际上是否位于工作空间/目录下之间存在一些细微差别。谁能解释这对我的布局意味着什么?

非常感谢!

薄层色谱法

Yet another multiple projects question, I know. I've seen (conflicting) answers to subsets of my goals but nothing that covers it all. I'm new to eclipse and don't know the dirty details of hg.

Given a common library jar, two apps and some common ant scripts...

I would set this up

/top/
    build-common/
    lib1/
    app1/
    app2/

I've read that eclipse doesn't do sub-projects so I think this would be 4 eclipse projects and "top" is nothing to eclipse.

I've read how to use ant for the eclipse builds including the auto build.

  • Is it good practice for the 3 java projects to reference ../build-common/{scripts} in their build.xmls? (when that's a different eclipse project)
  • Should app1 and app2 reference ../lib1/target/lib.jar? How?
  • If ant is doing the eclipse builds, do I still maintain .classpath (via whatever gui that was)?
  • I assume that eclipse users would not expect auto-build to propagate projects. Correct?

I'm unclear if having 4 eclipse projects forces 4 mercurial projects. IF the mercurialeclipse plugin supports it, I could make it one hg project ("top"). But I'm not sure of the pros and cons. Team->Commit might affect other eclipse projects -- would that be seem wrong to an eclipse user?

  • So, 4 or 1 hg projects?

Pre-eclipse, I would typically have a top level build.xml that builds the sub projects. Even if it's not needed for the eclipse builds, I want to support a full command-line build.

  • Where would a top level build.xml go?

Also, I suspect there are some nuances between having your code actually under the workspace/ directory or not. Can anyone explain what this means for my layout?

Thanks very much!

tlc

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

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

发布评论

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

评论(1

千仐 2024-11-17 03:21:51

我已经使用 CVS 完成了此类操作,但我不确定如何使用 Mercurial。 (我也想切换到 Mercurial)

我可以回答你的部分问题。

使用 CVS,我将为 /top/ 创建一个 Eclipse 项目,并将不同的模块作为子目录放入其中。我不知道 MercurialEclipse 是否支持子存储库,但这将是我的第一选择(1 个 Eclipse 项目,引入子存储库)

我认为如果有一个 ant 脚本引用 build-common 是可以的/app1 和 /app2 之间有很多依赖关系。另一种选择是在 /app1、/app2 中有一个 build.xml,然后在 /build-common 中有一个主 build.xml,它只调用 /app1 和 /app1。 /app2 然后最后将所有内容包装起来。

如果您使用 Ant 脚本,您还必须手动管理 Eclipse 类路径。以我的经验来看,这并不难。如果在 Eclipse 中设置了类路径,自动构建就可以工作。

我更喜欢这样的结构:

/top/
/top/build.xml (references /app1/build.xml, /app2/build.xml)
/lib1
/app1/
/app1/build.xml (references ../lib1)
/app2
/app2/build.xml  (references ../lib1)

最大的问题是 MercurialEclipse 和子存储库。但是,如果它不支持子存储库,只需从命令行使用 Hg 直到它跟上。

I've done this type of thing with CVS, but I'm not sure how with Mercurial. (I'm looking to switch to Mercurial too)

I can answer part of your questions.

With CVS, I would create one Eclipse project for /top/ and pull different modules into it as sub-directories. I don't know if MercurialEclipse support sub-repos or not, but that would be my first choice (1 Eclipse project, pull in sub-repos)

I think it is OK for each ant script to reference build-common if there is a lot of dependencies between /app1 and /app2. The other option is to have a build.xml in /app1, /app2, then a master build.xml in /build-common that just calls out to /app1 & /app2 and then wraps everything up in the end.

If you use an Ant script, you will also have to manually manage the Eclipse classpath. It isn't that difficult in my experience. If the classpath is setup in Eclipse, auto-build will just work.

I would prefer to have this structure:

/top/
/top/build.xml (references /app1/build.xml, /app2/build.xml)
/lib1
/app1/
/app1/build.xml (references ../lib1)
/app2
/app2/build.xml  (references ../lib1)

The biggest question is MercurialEclipse and sub-repos. However, if it doesn't support sub-repos, just use Hg from the command-line until it catches up.

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