thay đổi thuộc tính sonar của bạn như thế này:
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"//use your quality profile instead
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/"
}
}
Để tạo lint-quả-debug.xml bạn sẽ phải chạy lệnh dưới đây về thiết bị đầu cuối thu:
./gradlew lint
Nó sẽ tạo báo cáo XML còn thiếu. Hãy cẩn thận, nó có thể tạo ra một báo cáo cho mỗi biến thể xây dựng (Debug theo mặc định sẽ tạo ra xây dựng/đầu ra/lint-results-debug.xml). Vì vậy, bạn có thể gọi lintDebug, lintRelease ... phụ thuộc vào biến thể xây dựng của bạn.
Và thay đổi các thuộc 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
}
bây giờ nếu bạn chạy
./gradlew sonarqube
bạn sẽ nhận được kết quả thể hiện trên thực tế các báo cáo tập tin địa phương của nó đó là thực sự bị tổ chức trên máy chủ
Nguồn
2017-04-13 04:39:44
Bạn có thể tìm thấy một defini tive giải pháp? – FoY
Không, chúng tôi đang sử dụng đầu ra LINT trong Hudson/Jenkins và sử dụng Sonar để phân tích truyền thống, không phải Android. Kinda hút nhưng nó là những gì nó được. –