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

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

问题描述

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

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

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

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

推荐答案

你当然可以做一个简单的mvn sonar:sonar,这样就行了.

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

另一方面,Jenkins 的 SonarQube 插件将使配置更容易.例如,您将能够在一个地方(Jenkins 的配置部分)定义有关您的 SonarQube 服务器(URL、数据库用户和密码)或多个 SonarQube 服务器的信息,这样您就不必到处重复.

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.

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

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).

所以如果你只是做一些测试,你真的不需要这个插件.但如果您要设置 Jenkins 的生产实例,那么最好使用 SonarQube 插件.

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天全站免登陆