我正在为 gradle 尝试最新版本的声纳。下面是我编写的代码片段
app\build.gradle
apply plugin: 'org.sonarqube'
sonarqube {
properties {
property "sonar.host.url", "http://localhost:9000"
property "sonar.jdbc.url","jdbc:mysql://localhost:3306/sonar?useUnicode=true&characterEncoding=utf8&rewriteBatchedStatements=true&useConfigs=maxPerformance"
property "sonar.jdbc.driverClassName","com.mysql.jdbc.driver"
property "sonar.projectKey", "com.xyz"
property "sonar.projectName", "xyz"
property "sonar.version", "1.0"
property "sonar.jdbc.username", "sonar"
property "sonar.jdbc.password", "sonar"
property "sonar.sources", "./src/main/java"
property "sonar.tests", "./src/test/java"
property "sonar.java.binaries", "./build/intermediates/classes/debug"
property "sonar.junit.reportsPath", "./build/test-results/debug"
property "sonar.verbose", "false"
property "sonar.language", "java"
property "sonar.jacoco.reportPath", "${project.buildDir}/jacoco/testDebugUnitTest.exec"
}
}
主项目 build.gradle
buildscript {
repositories {
jcenter()
maven {
url "http://repo1.maven.org/maven2/"
}
maven {
url "https://plugins.gradle.org/m2/"
}
}
dependencies {
classpath 'com.android.tools.build:gradle:2.1.0'
classpath 'org.sonarsource.scanner.gradle:sonarqube-gradle-plugin:1.2'
}
}
但是运行 sonarQube ,给出以下错误。
Error:Execution failed for task ':app:sonarqube'.
> Can not invoke method public java.lang.Class org.sonar.plugins.surefire.SurefireSensor.dependsUponCoverageSensors()
请帮忙,我该如何解决这个问题。