【问题标题】:Get link to Sonar dashboard in Jenkins when calling 'gradle sonarRunner'调用“gradle sonarRunner”时获取指向 Jenkins 中的声纳仪表板的链接
【发布时间】:2014-03-15 22:07:55
【问题描述】:

通过 Jenkins 构建步骤 Invoke Standalone Sonar Analysis(可通过 Sonar plugin 获得),您可以在作业概览中获得到 SonarQube 仪表板的漂亮链接: .

由于an issue,我没有使用此构建步骤,而是有一个调用gradle sonarRunner 的构建步骤:

这是我build.gradle配置声纳的部分:

sonarRunner {
    sonarProperties {
    property "sonar.projectKey", projectId
    property "sonar.projectName", projectName

    // Address of SonarQube server
    property "sonar.host.url", "http://localhost:9000"

    // Database config
    property "sonar.jdbc.url", "jdbc:mysql://localhost:3306/sonar?useUnicode=true&characterEncoding=utf8&rewriteBatchedStatements=true"
    property "sonar.jdbc.driverClassName", "com.mysql.jdbc.Driver"
    property "sonar.jdbc.username", "root"
    property "sonar.jdbc.password", "superSecret"
    }
}

这很好用:就像 Invoke Standalone Sonar Analysis 构建步骤一样,我可以在 http://localhost:9000/dashboard/index/jutilsId 浏览 SonarQube 的结果。

不幸的是,这样一来,SonarQube 仪表板的链接就从 Jenkins 的工作概述中消失了。

This blog entry 描述了如何实现我想要的,但似乎已经过时,因为我在 SonarQube 的配置中找不到Check if this project is NOT built with maven 2 的选项。

有什么方法可以让我拥有这个链接并使用gradle sonarRunner


我的系统:

我正在使用 SonarQube Server 4.1.1、Gradle Plugin 1.23Sonar Plugin 2.1、Sonar Runner 2.3 和 gradle --version

------------------------------------------------------------
Gradle 1.10
------------------------------------------------------------

Build time:   2013-12-17 09:28:15 UTC
Build number: none
Revision:     36ced393628875ff15575fa03d16c1349ffe8bb6

Groovy:       1.8.6
Ant:          Apache Ant(TM) version 1.9.2 compiled on July 8 2013
Ivy:          2.2.0
JVM:          1.7.0_21 (Oracle Corporation 23.7-b01)
OS:           Linux 3.10-2-486 i386

【问题讨论】:

    标签: jenkins gradle sonarqube sonar-runner


    【解决方案1】:

    Sidebar-Link Plugin 来救援!

    1. 安装插件。
    2. sonar icon 放入/var/lib/jenkins/userContent。那在JENKINS_HOME 里面。如果您不知道JENKINS_HOME 在哪里,请查看/etc/default/jenkins 的配置文件。

    3. 在 作业的配置(您的网址会有所不同):

    4. 完成

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2017-08-05
      • 2014-11-30
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多