简体   繁体   English

从Eclipse Project到Hudson Build的最有效方法

[英]Most effective way to go from Eclipse Project to Hudson Build

We want to use Hudson/Jenkins to build our project which is currently realized entirely in Eclipse. 我们希望使用Hudson / Jenkins构建我们的项目,该项目目前完全在Eclipse中实现。 From what I can tell, there are various ways to go from A to B, or E to H, as it were: export as Ant script, export as Maven script, export as Runnable JAR while creating an Ant script for that, etc. 从我所知道的,有各种方法可以从A到B或E到H,例如:导出为Ant脚本,导出为Maven脚本,导出为Runnable JAR,同时为其创建Ant脚本等。

All of the above seem to have in common that between "This runs in Eclipse" and "Hudson produces something that runs" there are multiple steps which are independent, for example, you can change your project, commit to SVN and trigger a Hudson build, but unless you specifically remember to "Export as Ant Script" in between, it will fail. 以上所有似乎都有一个共同点,就是“在Eclipse中运行”和“Hudson生成运行的东西”之间存在多个独立的步骤,例如,您可以更改项目,提交SVN并触发Hudson构建,但除非你特别记得在其间“导出为Ant脚本”,否则它将失败。

Is there a "one in all" solution ? 有一个“一个一个”的解决方案吗? I'm not worried about the amount of clicks, but instead about the various steps in between that, to make matters worse, are only needed sometimes. 我并不担心点击量,而是关注两者之间的各种步骤,更糟糕的是,有时只需要点击。 In short: I am looking for something that goes from "I can click on the 'Run' button and it works" to "Hudson produces something that works" without every developer having to remember every optional step in between. 简而言之:我正在寻找的东西来自“我可以单击'运行'按钮,它可以”到“哈德森产生的东西”,而不是每个开发人员都必须记住其中的每个可选步骤。

Ideas ? 想法?

Edit: All of the answers so far seem to suffer from the same issue: it's all parallel development. 编辑:到目前为止,所有答案似乎都遇到了同样的问题:它是所有并行开发的。 You have your Eclipse Run Configuration, and you have Maven/Ant/Whatever build. 你有Eclipse Run Configuration,你有Maven / Ant / Whatever build。 If you change your run config, you have to then remember later to change your Maven/Ant/Whatever build, commit it, and then HOPE that all other developers notice the change to the Maven/Ant/Whatever build during their daily SVN Update, manually open the file, inspect the changes and then duplicate those changes in their own run configs. 如果你改变你的运行配置,你必须记得以后更改你的Maven / Ant / Whatever build,提交它,然后HOPE,所有其他开发人员都注意到他们在每日SVN更新期间对Maven / Ant / Whatever构建的更改,手动打开文件,检查更改,然后在自己的运行配置中复制这些更改。 That seems like it's just begging for bugs and mistakes, isn't there anything that's properly integrated with the Eclipse Run Configurations ? 这似乎只是在乞求错误和错误,是不是有任何与Eclipse Run Configurations正确集成的东西?

Hudson can build Maven or Ant projects, so the first step is to get a reproducible build with either tool, which you only need to set up one time. Hudson可以构建Maven或Ant项目,因此第一步是使用任一工具获得可重现的构建,您只需要设置一次。 Then you need to take that pom.xml or build.xml file and actually commit it to Subversion. 然后,您需要获取该pom.xml或build.xml文件,并将其实际提交给Subversion。 This is necessary since Hudson won't open Eclipse and will instead use the command-line to execute a build. 这是必要的,因为Hudson不会打开Eclipse,而是使用命令行来执行构建。

Then you can setup a new Hudson job that will watch Subversion for any changes. 然后你可以设置一个新的Hudson作业,它将观察Subversion的任何变化。 Your developers can use their normal workflow, where they use Eclipse to do builds and commit changes to source control when they're ready. 您的开发人员可以使用他们的正常工作流,他们使用Eclipse进行构建,并在源代码控制准备就绪时提交更改。 Hudson will see it and pull down a fresh copy of the code base, and then will do its own compile and will report back any problems. Hudson将看到它并下载代码库的新副本,然后将自己编译并报告任何问题。

Personally I prefer Maven2, since I know Hudson has solid integration with it and will do things like run your JUnit tests. 我个人更喜欢Maven2,因为我知道Hudson与它有很好的集成,并且会运行你的JUnit测试。 Eclipse used to be painful with Maven, but now there's the m2eclipse plugin . Eclipse曾经对Maven感到痛苦,但现在有了m2eclipse插件

I'd try http://www.ant4eclipse.org/ . 我试试http://www.ant4eclipse.org/

It allows you to build your eclipse project from an ant file. 它允许您从ant文件构建您的eclipse项目。 From the first paragraph here: http://www.ant4eclipse.org/node/6 it sounds very much like what you want. 从这里的第一段开始: http//www.ant4eclipse.org/node/6听起来非常像你想要的。 With ant4eclipse ant will access your eclipse project and then it should be able to build through Hudson. 使用ant4eclipse,ant将访问你的eclipse项目,然后它应该能够通过Hudson构建。

The aim of the ant4eclipse project is to avoid (or at least: to reduce) the redundancy of Eclipse and Ant configurations. ant4eclipse项目的目的是避免(或至少:减少)Eclipse和Ant配置的冗余。 More precisly: it consists of Ant tasks that are able to read and work with some of Eclipse's configuration files. 更精确:它包含能够读取和使用Eclipse的一些配置文件的Ant任务。

Migrating to Maven, Hudson has great first class intergration with Maven. 迁移到Maven后,Hudson与Maven进行了一流的整合。

Maven 3 + Archiva makes a very potent build system. Maven 3 + Archiva构建了一个非常强大的构建系统。 Of course there are other Repository Managers but Archiva does just enough for what I need. 当然还有其他存储库管理器,但Archiva足以满足我的需求。

Once you get Maven, you really wonder how you did without it up until then. 一旦你得到了 Maven,你真的很想知道在那之前你是如何做到的。 A dedicated private Repository Manager helps this greatly, that is why Archiva is important to the mix. 专用的私有存储库管理器可以极大地帮助这一点,这就是Archiva对于这一点非常重要的原因。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM