且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

为什么要为 Jenkins 使用 SonarQube 插件,而不是简单地使用 maven 目标声纳:声纳?

更新时间:2023-11-17 23:18:22

你当然可以做一个简单的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(这对 Java 以外的其他不依赖 Maven 构建的语言很有帮助).

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.