当获取'gradle sonarRunner'时,获取Jenkins的Sonar仪表板链接

Mat*_*aun 7 gradle jenkins sonar-runner sonarqube

使用Jenkins构建步骤Invoke Standalone Sonar Analysis(可通过Sonar插件获得),您可以在作业概述中获得SonarQube仪表板的这个很好的链接: 声纳链接.

由于存在问题,我没有使用此构建步骤,而是使用调用的构建步骤gradle sonarRunner: 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"
    }
}
Run Code Online (Sandbox Code Playgroud)

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

不幸的是,通过这种方式,SonarsQube仪表板的链接已经从Jenkins的工作概述中消失了.

这篇博客文章描述了如何实现我想要的但似乎已经过时,因为我在SonarQube的配置中找不到任何选项Check if this project is NOT built with maven 2.

有什么方法可以使用此链接并使用gradle sonarRunner吗?


我的系统:

我正在使用SonarQube Server 4.1.1,Gradle Plugin 1.23,Sonar 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
Run Code Online (Sandbox Code Playgroud)

Mat*_*aun 9

Sidebar-Link插件救援!

  1. 安装插件.
  2. 声纳图标放入/var/lib/jenkins/userContent.那就在里面JENKINS_HOME.如果您不知道在哪里JENKINS_HOME,请查看配置文件/etc/default/jenkins.

  3. 在作业的配置中设置这样的链接(您的URL将不同): 侧边栏链接配置

  4. 完成