Java、Eclipse、Ant、JUnit、Hudson、SVN、本机库;它们可以共存吗?
完成以下所有任务的最正确方法是什么:
- 在 Eclipse 中创建项目
- Apache Ant 构建文件
- 使用 Hudson(或另一个更推荐的 CI 系统?)使用的
- 并支持运行的 JUnit 测试通过 Ant/Hudson 和 Eclipse
- 并将正确的文件夹结构检查到 SVN 中,以便将来的开发人员可以复制构建,Hudson 可以自动从 SVN 获取并运行 Ant 文件来构建/测试/部署项目
- 并且该项目具有本机库,如果这有什么区别(我已经编写了一个 Ant 任务,可以根据操作系统下载并解压适当的库文件)
我的项目已经有一些源文件和一个 Ant 文件,但我一直遇到麻烦以有组织的方式将其与 Eclipse 集成,所以我真的很想从一个新的 Eclipse 项目开始,正确设置它,然后将我的 Ant 文件和源文件逐个复制到最 Eclipse 中的项目中-兼容的方式。
我将继续尝试一切,试图让它按照我喜欢的方式工作。但如果您有此类事情的经验,也许在您的工作场所,请提供尽可能多的信息。
我的主要目标是学习一次并在未来的项目中使用它。目前,我正在开发一个客户端-服务器应用程序,由 JOGL 小程序前端(使用 JNLP 文件)和无人值守服务器应用程序组成。到目前为止,我一直都是手工完成这一切:在 Eclipse 中编写和构建,将 applet jar 拖到我的 FTP 客户端中,通过 SSH 连接服务器 jar 并手动重新启动它,所有这些都没有测试过程。我希望到最后,构建过程将是这样的:使用本机库的副本在我的计算机上进行本地测试;将代码更改提交到 SVN; Hudson svn update
s,使用 Ant 构建文件来编译和运行所有 JUnit 测试;如果所有测试都通过,它将继续将服务器 jar 复制到我的专用服务器并重新启动正在运行的服务器实例,然后将客户端 jar 复制到我的 Web 服务器。
What is the most proper way to accomplish all of the following:
- Create a project in Eclipse
- With an Apache Ant buildfile
- That Hudson (or another more recommended CI system?) uses
- And support for JUnit tests that are run by both Ant/Hudson and Eclipse
- And check the proper folder structure into SVN so that future developers can replicate the build, and Hudson can automatically grab from SVN and run the Ant file to build/test/deploy the project
- And the project has native libraries, if that makes any difference (I've already written an Ant task that can download and unzip the proper library files depending on the OS)
I already have my project with some source files and an Ant file, but I've been having trouble integrating it with Eclipse in an organized manner, so I would really love to start from a fresh Eclipse project, set it up correctly, and then copy my Ant file and my source files piece-by-piece into the project in the most Eclipse-compatible way.
I will be continuing to play around with everything in an attempt to get it working as I like it. But if you have experience with this sort of thing, perhaps at your workplace, please give as much information as you can.
My main goal here is to learn this once and use it in my future projects. For now, I am developing a client-server application consisting of a JOGL applet frontend (using JNLP files) and an unattended server app. Up until now I've been doing it all by hand: writing and building in Eclipse, dragging the applet jar into my FTP client, SSHing the server jar and restarting it by hand, and all with no testing process. I'm hoping that by the end, the build process will be something like this: test locally on my machine with a copy of the native libraries; commit code changes to SVN; Hudson svn update
s, uses the Ant buildfile to compile and run all JUnit tests; if all the tests pass, it proceeds to copy the server jar to my dedicated server and restart the running server instance, and then copy the client jar to my web server.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
当我开始一个新项目时,我通常采取以下步骤:
现在,来自 Hudson:
您可以在构建脚本中从 Ant 调用 JUnit 测试(首先使用
javac
任务编译它们,然后使用 <代码>junit任务)。如果您要求,Hudson 将跟踪测试结果。您可以使用 shell 脚本构建步骤将服务器 jar 复制到需要的位置,然后重新启动服务器实例。就像 Mnementh 所说,听起来你已经对本地库进行了排序......
When I start a new project, I generally take the following steps:
Now, from Hudson:
You can invoke your JUnit tests from Ant in the build script (first compile them with the
javac
task, then run them with thejunit
task). Hudson will track the test results if you ask it to.You can use a shell script build step to copy your server jar to where it's needed, and restart the server instance. Like Mnementh said, it sounds like you've got the native libraries sorted...
如果您不依赖于使用 ant,并且准备使用 Maven,那么这只是一个问题使用 Eclipse 插件 设置 Maven,它会为您生成 Eclipse 项目。
Hudson 已经知道如何构建 Maven 项目,因此这一点已经得到解决。
只要你可以将你的项目拉到eclipse中,那么它就能够运行单元测试,而hudson也可以使用前面提到的maven支持来运行单元测试。
如果您使用 Maven,那么您将需要遵循其有关如何创建项目的指南,这是一个很好的起点。
希望这有帮助。
If you are not tied to using ant, and are prepared to use Maven, then it is simply a matter of setting up Maven with the Eclipse plugin which generates the Eclipse projects for you.
Hudson already knows how to build Maven projects, so that is taken care of.
So long as you can pull your projects into eclipse, then it will be able to run the unit tests, and hudson can use the previously mentioned maven support to run the unit tests as well.
If you use Maven, then you will want to follow it's guidelines on how to create a project, here is a good starting point.
Hope this helps.
在我们公司,我们实际上使用 Eclipse、Java、Ant、SVN、Junit 和 Hudson。这就是您提到的除了本机库之外的所有内容。如果您说您的 ant-buildscript 已经可以与本机库一起使用,那么问题似乎也解决了。要将其很好地集成到 eclipse 中,您可以通过两种方式完成:也可以从 Eclipse 使用 Ant(有缺点),或者开发人员必须为其机器正确安装本机库,以便 Eclipse 可以毫无问题地编译并持续集成它将由 Ant 下载。
At our company we actually use Eclipse, Java, Ant, SVN, Junit and Hudson. That is all you mentioned except the native libraries. If you said your ant-buildscript already works with the native libraries that problem seems solved too. To integrate it well into eclipse you could do it in two ways: Use Ant also from Eclipse (has downsides) or the developer has to install the native library for his machine properly, so that Eclipse can compile without a problem and for continuous integration it will be downloaded by Ant.