开发者

eclipse, ant & mercurial with multiple (sub) projects

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 f开发者_开发技巧orces 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


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜