我对集成gradle 2.14和sonarqube 5.6 LTS有一点问题。 我的gradle.build如下所示:
repositories {
mavenCentral()
jcenter()
maven {
url "https://plugins.gradle.org/m2/"
}
}
dependencies {
'org.sonarsource.scanner.gradle:sonarqube-gradle-plugin:1.2'
....
}
apply plugin: 'org.sonarqube'
和gradle属性:
systemProp.sonar.host.url=http://localhost:9000
systemProp.sonar.login=sonar
systemProp.sonar.password=sonar
systemProp.sonar.sourceEncoding=UTF-8
systemProp.sonar.projectKey=some_project...
systemProp.sonar.ws.timeout=60
甚至当我更改这样的最新版本插件时:
buildscript {
repositories {
maven {
url "https://plugins.gradle.org/m2/"
}
}
dependencies {
classpath "org.sonarsource.scanner.gradle:sonarqube-gradle-plugin:2.0.1"
}
}
apply plugin: "org.sonarqube"
我得到了异常(gradle with mode --info):
:sonarqube FAILED
:sonarqube (Thread[Task worker,5,main]) completed. Took 1.421 secs.
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':sonarqube'.
> Unable to load component class org.sonar.batch.bootstrap.BatchPluginInstaller
感谢您的帮助。
答案 0 :(得分:1)
正如您在documentation of the SonarQube Scanner for Gradle上所看到的,在Gradle构建文件中激活SonarQube分析的官方和支持方式很简单:
plugins {
id "org.sonarqube" version "2.0.1"
}
我刚刚测试过,它运作顺畅。所以你应该简化你的构建文件,只需要这些行。