【发布时间】:2016-08-13 14:49:11
【问题描述】:
我正在努力为多模块项目正确设置 SonarQube 5.4。我已经阅读了here、here 和here,所有提供的解决方案都不能解决我的错误:我在声纳分析期间对我创建的每个类(不是我包含的库)发出警告:
“无法通过类加载器访问类 XYZ。”
我在 Sonar 仪表板中没有得到任何结果(无论是在 localhost 还是在 Jenkins 上),甚至分析的时间都没有更新。 我使用的是 Gradle 2.10,这是我的根 Gradle 文件:
buildscript {
repositories {
jcenter()
mavenCentral()
maven {
url "https://plugins.gradle.org/m2/"
}
}
dependencies {
classpath 'com.android.tools.build:gradle:2.0.0'
classpath 'com.neenbedankt.gradle.plugins:android-apt:1.8'
classpath "org.sonarsource.scanner.gradle:sonarqube-gradle-plugin:2.0-rc1"
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
apply from: 'buildsystem/dependencies.gradle'
apply plugin: "org.sonarqube"
subprojects {
sonarqube {
properties {
property "sonar.host.url", "http://localhost:9000/"
property "sonar.sources", "./src/main/java"
property "sonar.java.binaries", "./build/"
property "sonar.projectKey", "net.project"
property "sonar.projectName", "Project Android"
property "sonar.projectVersion", "0.5"
property "sonar.sourceEncoding", "UTF-8"
}
}
}
allprojects {
ext {
androidApplicationId = 'net.project'
androidVersionCode = 1
androidVersionName = "0.5"
testInstrumentationRunner = "android.support.test.runner.AndroidJUnitRunner"
testApplicationId = 'com.beatclip.android.presentation.test'
}
repositories {
jcenter()
}
}
task wrapper(type: Wrapper) {
description 'Creates the gradle wrapper.'
gradleVersion '2.10'
}
可能是 Dagger2 的问题吗?我在模块集的 Gradle 文件中没有 SonarQube 配置,因为 this example from SonarQube 也没有在模块 Gradle 文件中提供任何 Sonar 配置。
感谢任何帮助或示例! :)
【问题讨论】:
标签: android gradle sonarqube sonarqube-scan