我尝试在 Android 项目上使用最后一个SonarQube
插件。Gradle
我遵循这个: http ://docs.sonarqube.org/display/SCAN/Analyzing+with+SonarQube+Scanner+for+Gradle
我的root.gradle:
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.1.0'
}
}
plugins {
id "org.sonarqube" version "2.0.1"
}
allprojects {
repositories {
jcenter()
}
}
我的 app.gradle
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "23.0.3"
defaultConfig {
applicationId "com.xxxxxx.xxxxxx"
minSdkVersion 15
targetSdkVersion 17
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
versionCode 232
versionName "2.3.2"
}
buildTypes {
debug {
debuggable true
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
lintOptions {
checkReleaseBuilds false
abortOnError false
}
testOptions {
unitTests.returnDefaultValues = true
}
}
sonarqube {
properties {
property "sonar.projectName", "xxxxx"
property "sonar.projectKey", "org.sonarqube:com.xxxxxxx.xxxxxxxx"
property "sonar.sources", "src/main/java"
property "sonar.java.binaries","build/intermediates/classes"
property "sonar.tests", "src/test/java"
property "sonar.android.lint.report", "build/lint-results.xml"
property "sonar.junit.reportsPath", "build/test-results/debug/"
}
}
dependencies {
compile 'com.android.support:support-v4:23.4.0'
androidTestCompile 'junit:junit:4.12'
testCompile 'junit:junit:4.12'
}
我跑
./gradlew sonarqube -Dsonar.verbose=true
日志:
Incremental java compilation is an incubating feature.
:sonarqube
Bytecode of dependencies was not provided for analysis of source files, you might end up with less precise results. Bytecode can be provided using sonar.java.libraries property
sonar.binaries and sonar.libraries are deprecated since version 2.5 of sonar-java-plugin, please use sonar.java.binaries and sonar.java.libraries instead
Bytecode of dependencies was not provided for analysis of test files, you might end up with less precise results. Bytecode can be provided using sonar.java.test.libraries property
Class 'com/xxxxxx/xxxxxxx/ChangelogActivity' is not accessible through the ClassLoader.
Class 'com/xxxxxx/xxxxxxx/ChangelogActivity$1' is not accessible through the ClassLoader.
Class 'com/xxxxxx/xxxxxxx/ConfigActivity' is not accessible through the ClassLoader.
Class 'com/xxxxxx/xxxxxxx/ConfigActivity$1' is not accessible through the ClassLoader.
我在所有课程中都收到此错误消息。