像这样更改您的声纳属性:
apply plugin: "org.sonarqube"
sonarqube {
properties {
property "sonar.projectName", "appa"
property "sonar.projectKey", "appa_app"
property "sonar.projectVersion", "1.0"
property "sonar.analysis.mode", "publish"
property "sonar.language", "java"
property 'sonar.sourceEncoding', "UTF-8"
property "sonar.sources", "./src/main"
//property "sonar.exclusions", "**/*Entity.java"
// property "sonar.exclusions", "src/main/java/com/apparkb/model/**, **/*Entity.java"
property "sonar.host.url", "http://192.168.21.33:9000"
property "sonar.login", "admin"
property "sonar.profile", "testlint"
property 'sonar.import_unknown_files', true
property "sonar.android.lint.report", "./build/outputs/lint-results-debug.xml"
property "sonar.password", "admin"
property "sonar.java.binaries", "build/"
}
}
要创建 lint-results-debug.xml,您必须在工作室终端上运行以下命令:
./gradlew lint
它将生成丢失的 XML 报告。
注意,它可以为每个构建变体生成报告(Debug 默认会生成 build/outputs/lint-results-debug.xml)。因此,您可以调用 lintDebug、lintRelease...,具体取决于您的构建变体。
并将 lint 属性更改为:
lintOptions {
// set to true to turn off analysis progress reporting by lint
quiet true
// if true, stop the gradle build if errors are found
abortOnError false
// do not ignore warnings
warningsAsErrors true
}
现在如果你运行 ./gradlew sonarqube
您将获得实际托管在服务器上的本地文件报告显示的结果