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

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

问题描述

我想与Jenkins一起针对Maven 2项目启动SonarQube分析.我首先在构建配置中使用了目标sonar:sonar.

但是我刚刚找到了Jenkins的SonarQube插件.为什么要使用它?这是更好的做法吗?为什么?

解决方案

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

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

该插件还提供了即时运行SonarQube分析的功能(无需Maven):您只需要提供一些必填属性(例如sonar.projectKeysonar.projectVersion),该插件即可启动Java Standalone对您透明地运行Runner(这对Java以外的其他语言非常有用,Java不依赖于Maven进行构建.)

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

I want to launch SonarQube analysis with Jenkins for a Maven 2 project. I first used the goal sonar:sonar in the build configuration.

But I just found the SonarQube plugin for Jenkins. Why use it? Is it a better practice and why?

解决方案

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

On the other side, there's the SonarQube plugin for Jenkins that will make the configuration easier. For instance you will be able to define information about your SonarQube server (URL, DB user and password) or your multiple SonarQube 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 SonarQube 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 SonarQube plugin.

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

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