声纳与 SVN 集成

发布于 2024-11-28 01:47:15 字数 84 浏览 0 评论 0原文

我正在使用 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

翻了热茶 2024-12-05 01:47:15

不要做复杂的事情作为预提交钩子!当用户进行提交时,控制权直到预提交挂钩完成后才会返回给用户。由于 Sonar 必须编译您的代码,因此您的用户将必须等待每次提交以下操作:

  • 检查代码
  • 编译代码
  • 运行所有测试并检查 Sonar 是否执行
  • 等待 Sonar 完成其报告并更新其数据库

如何这一切需要多长时间? 10分钟? 20分钟? 5分钟?假设您的代码很小或者您的编译器非常快,因此只需要 4 分钟。您的用户是否希望每次执行提交时等待 4 分钟才能重新开始工作?

相反,获得一个持续构建服务器,例如 Jenkins。 Jenkins 快速且易于设置。这是一个简单的 *.war 文件。你只需运行:

$ java -jar 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:

  • Checking out the code
  • Compiling the code
  • Running all of the tests and checks that Sonar performs
  • Waiting for Sonar to complete its reporting and updating its database

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:

$ java -jar jenkins.war

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.

苦行僧 2024-12-05 01:47:15

你可以调查哈德森。有一个声纳插件。

You could investigate Hudson. There is a Sonar plugin for it.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文