声纳与 SVN 集成
我正在使用 SVN 作为我的项目的版本管理工具,并计划使用 sonar 进行项目分析。
如何在每次将代码签入 SVN 时运行声纳项目分析?
I am using SVN as a version management tool for my project, and am planning to use sonar for project analysis.
How do I make sonar project analysis run every time code is checked into SVN?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
不要做复杂的事情作为预提交钩子!当用户进行提交时,控制权直到预提交挂钩完成后才会返回给用户。由于 Sonar 必须编译您的代码,因此您的用户将必须等待每次提交以下操作:
如何这一切需要多长时间? 10分钟? 20分钟? 5分钟?假设您的代码很小或者您的编译器非常快,因此只需要 4 分钟。您的用户是否希望每次执行提交时等待 4 分钟才能重新开始工作?
相反,获得一个持续构建服务器,例如 Jenkins。 Jenkins 快速且易于设置。这是一个简单的 *.war 文件。你只需运行:
然后,你就可以运行了。一旦哈德森站起来,你就定义了一个“工作”。只需输入所需信息并保存即可。每次有人在 Subversion 中进行提交时,Hudson 都会在后台构建。
所有的乐趣来自于数十个(也许数百个)可以扩展 Jenkins 的第三方插件。例如,有一个声纳插件可以运行您的声纳任务、更新数据库并生成一些漂亮的报告。
如果出现问题,Jenkins 会向负责人和整个开发团队发送电子邮件。 (插件允许 Jenkins 进行即时消息、发推文,甚至将红绿灯从绿色更改为红色)。这种即时反馈和公共知识将使您的开发人员在提交之前进行自己的测试。
Do not do complex stuff as a pre-commit hook! When a user does a commit, control does not return to the user until after the pre-commit hook has completed. Since Sonar has to compile your code, your users will have to wait on every commit for the following:
How long will all of this take? 10 minutes? 20 minutes? 5 minutes? Let's assume that your code is small or your compiler is very fast, so it takes a mere 4 minutes. Do your users want to wait 4 minutes each and every time they perform a commit in order to start their work again?
Instead, get a continuous build server like Jenkins. Jenkins is fast and simple to setup. It's a simple *.war file. You simply run:
And, you're up and running. Once Hudson is up, you define a "job". Just enter in the required information, and save. Every time, someone does a commit in Subversion, Hudson will build in the background.
Where all the fun comes in are the dozens (and maybe hundreds) of third party plugins that can extend Jenkins. For example, there's a Sonar plugin that will run your Sonar tasks, update your database, and produce some nice looking reports.
If there are problems, Jenkins will email the person responsible and the entire development team. (Plugins allow Jenkins to IM, Tweet, and even change a stoplight from green to red). This immediate feedback and public knowledge will get your developers to do their own tests before doing a commit.
你可以调查哈德森。有一个声纳插件。
You could investigate Hudson. There is a Sonar plugin for it.