在 Hudson 或其他 CI 工具中使用 Ant 自动签出和编译 Eclipse 项目的最佳方法? [英] Best way to automatically check out and compile Eclipse projects with Ant in Hudson or another CI tool?

查看:15
本文介绍了在 Hudson 或其他 CI 工具中使用 Ant 自动签出和编译 Eclipse 项目的最佳方法?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们有几个产品有很多共享代码并且必须维护几个版本.

We have several products which have a lot of shared code and which must be maintained several versions back.

为了解决这个问题,我们使用了很多 Eclipse 项目,其中一些包含库 jar,一些包含共享源代码(在多个项目中,以避免获得具有大量依赖项的巨大堆,同时能够从头开始编译所有内容以确保源代码并且二进制文件是一致的).我们使用 projectSet.psf 管理这些项目,因为它们可以直接从 CVS 中拉出所有项目并留下一个准备充分的工作区.我们不直接进行 ant 构建或使用 maven.

To handle this we use a lot of Eclipse projects, some contain library jars, and some contain shared source code (in several projects to avoid getting a giant heap with numerous dependencies while being able to compile everything from scratch to ensure that source and binaries are consistent). We manage those with projectSet.psf's as these can directly pull all projects out from CVS and leave a fully prepared workspace. We do not do ant builds directly or use maven.

我们现在希望能够将所有这些项目及其各种版本放入一个持续集成工具中——我喜欢 Hudson,但这只是个人喜好问题——这基本上意味着我们需要一种自动的方式来检查项目到一个新的工作区,并按照每个项目的项目文件中的描述编译源文件夹.Hudson 没有提供这样的方法来构建项目,所以我一直在考虑最好的方法是什么.

We now want to be able to put all these projects and their various versions in a Continous Integration tool - I like Hudson but this is just a matter of taste - which essentially means that we need to get an automatic way to check out the projects to a fresh workspace, and compile the source folders as described in the project-files in each project. Hudson does not provide such an approach to build a project, so I have been considering what the best way to approach this would be.

想法已经

  • 查找或编写一个能理解 projectSet.psf 并映射到 cvs-checkout 和编译标签的 ant 插件/转换器.
  • 在 Eclipse 中创建 build.xml 文件并使用它们.我试过这个,发现结果很冗长,而且绝对位置不适合自动工具将文件放在他们想要的位置.
  • 编写一个理解 projectSet.psf 的 Hudson 插件以派生配置并构建它.
  • 只要硬着头皮手动创建和更新 CI 配置就可以了——我不喜欢这样 :)

我真的很想听听其他人的经历,以便我决定如何处理.

I'd really like to hear about other peoples experiences so I can decide how to approach this.

另一种选择可能是使用更了解 Eclipse 项目和/或项目集的 CI.我们不信教——这只是让东西运行起来而不必自己做所有事情的问题.巡航控制可能是一个更好的选择吗?其他人?

Another option might be using a CI which knows better about Eclipse projects and/or project sets. We are not religious - this is just a matter of getting stuff running without having to do everything ourselves. Would Cruise Control be a better option perhaps? Others?

发现 ant4eclipse 有一个团队项目集"设施.http://ant4eclipse.sourceforge.net/

Found that ant4eclipse has a "Team Project Set" facility. http://ant4eclipse.sourceforge.net/

使用 ant4eclipse 和 ant-contrib ant 扩展来构建一个完整的工作区作为一个 sjgned 可运行 jar 文件,类似于 Eclipse 3.5M6 中的可运行 Jar 工具.我仍然依赖 Eclipse 来创建初始的空工作区,并提取 ProjectSet,所以这是下一个障碍.

Used the ant4eclipse and ant-contrib ant extensions to build a complete workspace as a sjgned runnable jar file similar to the Runnable Jar facility in Eclipse 3.5M6. I am still depending on Eclipse to create the initial empty workspace, and extract the ProjectSet, so that is the next hurdle.

以双重配置结束,即 Hudson 从 CVS 中提取与 ProjectSet.pdf 文件中列出的相同的模块集(需要具有相同的标签),从而使它们彼此相邻.然后 ant4eclipse 可以很好地与嵌入在主模块中的 projectSet.psf 文件配合使用.警告:必须手动更新 Hudson 中的模块列表,并且之后似乎需要手动清理工作空间,以便让 Hudson 发现"现在比以前有更多的项目.几个月来,这对我们来说效果很好,但是让所有的东西都在 ant 文件中工作是相当乏味的.

Ended up with a dual configuration, namely that Hudson extracts the same set of modules as listed in the ProjectSet.pdf file from CVS (which needs to have the same tag) causing them to be located next to each other. Then ant4eclipse works well with the projectSet.psf file embedded in the main module. Caveat: Module list in Hudson must be manually updated, and it appears that a manual workspace cleanup is needed afterwards to let Hudson "discover" that there is more projects now than earlier. This has now worked well for us for a couple of months, but it was quite tedious to get everything working inside the ant file.

在 Hudson 的 CVS 项目中,使用 ant4eclipse 和 Ctrl-A、Ctrl-C 在项目面板中使用 Ctrl-V 的使用团队项目"已经证明工作得很好,足以让我们接受(对于成熟的项目很少改变).我正在等待 ant4eclipse 1.0 的发布 - http://www.ant4eclipse.org/,目前处于里程碑2 - 看看有多少本土功能可以用 ant4eclipse 代替.

The "Use Team Projects" with ant4eclipse and a Ctrl-A, Ctrl-C in Project Panel with a Ctrl-V in the CVS projects in Hudson has turned out to work well enough for us to live with (for mature projects this is very rarely changed). I am awaiting the release of ant4eclipse 1.0 - http://www.ant4eclipse.org/, currently in milestone 2 - to see how much homegrown functionality can be replaced with ant4eclipse things.

ant4eclipse 在 M4 中截至 20100609,所以时间表在 http://www.ant4eclipse.org/node?page=1 有点下滑.

ant4eclipse is as of 20100609 in M4 so the schedule at http://www.ant4eclipse.org/node?page=1 is slipping somewhat.

在长时间使用我们的 ant4eclipse 方法后,我的结论是构建脚本变得非常粗糙并且难以维护.Team ProjectSet 工具(ant4eclipse 用来定位项目)也适用于基于 CVS 的存储库,但在我们迁移到 git 之后就不行了(这本身就是一件大事).新项目很可能基于 maven,因为这在 Jenkins 中得到了很好的支持.

My conclusion after using our ant4eclipse approach for a longer period is that the build script get very gnarly and is hard to maintain. Also the Team ProjectSet facility (which ant4eclipse use to locate the projects) which works well for CVS based repositories, but not after we migrated to git (which is a big thing in itself). New projects will most likely be based on maven, as this has good support in Jenkins.

推荐答案

写一个 Hudson 插件理解 projectSet.psf 的导出配置并构建它.

Write a Hudson plugin which understands projectSet.psf's to derive a configuration and build it.

这对我来说似乎是成功的答案.

That seems like the winning answer to me.

我使用 CruiseControl 而不是 Hudson,但根据我的经验,如果您可以创建一个插件来解决您的问题,它将很快获得回报.编写一个适合您的解决方案的插件通常很容易,而不是需要在类似情况下为每个人工作的插件.

I work with CruiseControl rather than Hudson but in my experience if you can create a plugin that solves your problem it will quickly payoff. And it is generally pretty easy to write a plugin that is custom fit for your solution as opposed to one that needs to work for everyone in a similar situation.

这篇关于在 Hudson 或其他 CI 工具中使用 Ant 自动签出和编译 Eclipse 项目的最佳方法?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆