I really got an 'overflow' trying to make these things to work together. I followed instruction from here: http://docs.sonarqube.org/display/PLUG/Android+Lint+Plugin and finally got a SonarQube 5.1.1 server with Android Lint plugin 1.1 installed. Then I configured my multi-module Gradle build to work with SonarQube plugin: see code fragment from root config below.
plugins {
id 'org.sonarqube' version '1.0'
}
sonarqube {
properties {
property 'sonar.host.url', 'sonarqube-server:9000'
property 'sonar.jdbc.url', 'jdbc:mysql://sonarqube-db:3306/sonar?useUnicode=true&characterEncoding=utf8'
property 'sonar.jdbc.driverClassName', 'com.mysql.jdbc.Driver'
property 'sonar.jdbc.username', 'sonar'
property 'sonar.jdbc.password', 'sonar'
property 'sonar.sourceEncoding', 'UTF-8'
property 'sonar.login', 'admin'
property 'sonar.password', 'admin'
property 'sonar.profile', 'Android Lint'
property 'sonar.import_unknown_files', true
property 'sonar.android.lint.report', 'build/outputs/lint-results.xml'
}
}
And after that I ran lint sonarqube
task to execute the analysis. As a result I got a bulk of Lint errors regarding 'retrolambda' project (java.lang.UnsupportedOperationException: Unknown ASTNode child: LambdaExpression
), which is quite normal, and lint-results.xml
(accompanied with HTML version) files per each module containing descriptions of issues discovered. The report said that there were 8 errors and 434 warnings found. But things went wrong when sonarqube plugin tried to upload the results to SonarQube server. The log was full of 'Unable to find file' and 'Unable to find rule' messages. And when the processing was over, then there were no issues reported for my project on SonarQube server.
And I am wondering, what did went wrong? I checked the paths, and all files were there. I looked through all discussions I could reach, and it seems like my config is correct and I do everything right. Does anybody have any clue, what I missed and what needs to be checked? Any suggestions or ideas are welcome.
I will be also happy if there is a way to import lint data using external SonarQube Runner, since this tool seems to be more predictable and stable then a Gradle plugin.