为什么要为Jenkins使用声纳插件,而不是简单地使用Maven目标"sonar:sonar"? [英] Why use sonar plugin for Jenkins rather than simply use maven goal "sonar:sonar"?

查看:111
本文介绍了为什么要为Jenkins使用声纳插件,而不是简单地使用Maven目标"sonar:sonar"?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想与Jenkins一起为Maven 2项目启动声纳分析.我首先在构建配置中使用了目标"sonar:sonar".但是我刚刚找到了Jenkins的声纳插件.为什么要使用它?这是更好的实践吗?为什么?

解决方案

您当然可以做一个简单的"mvn sonar:sonar",这将起作用.

另一方面,还有Jenkins的Sonar插件,可以简化配置.例如,您将能够在一个位置(Jenkins的配置部分)定义有关Sonar服务器(URL,数据库用户和密码)或多个Sonar服务器的信息,从而不必在任何地方重复. /p>

该插件还提供了动态运行Sonar分析的功能(无需Maven):您只需要提供一些必填属性(例如"sonar.projectKey"和"sonar.projectVersion"),该插件就会透明地为您启动Java Standalone Runner(这对Java以外的其他语言(不依赖于Maven的构建)很有帮助).

因此,如果您只是进行一些测试,则实际上不需要此插件.但是,如果您要设置Jenkins的生产实例,那么最好使用Sonar插件.

I want to launch sonar analysis with Jenkins for a Maven 2 project. I first used the goal "sonar:sonar" in the build configuration. But I just found the sonar plugin for Jenkins. Why use it ? Is it a better pratice and why ?

解决方案

You can of course do a simple "mvn sonar:sonar", this will work.

On the other side, there's the Sonar plugin for Jenkins that will make the configuration easier. For instance you will be able to define information about your Sonar server (URL, DB user and password) or your multiple Sonar servers in a single place (the configuration section of Jenkins) so that you don't have to repeat it everywhere.

The plugin also offers the ability to run a Sonar analysis on the fly (without Maven): you just have to provide some mandatory properties (like "sonar.projectKey" and "sonar.projectVersion" for instance) and the plugin will start the Java Standalone Runner transparently for you (this is helpful mostly for other languages than Java which don't rely on Maven for their build).

So if you're just making some tests, you don't really need this plugin. But if you're setting up a production instance of Jenkins, then it's best to use the Sonar plugin.

这篇关于为什么要为Jenkins使用声纳插件,而不是简单地使用Maven目标"sonar:sonar"?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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