Add the following configuration in Build.gradle
- Legacy Plugins
Apply plugin: ' Sonar '
Sonar {
server { url = "http://locahost:9000"
}
Database {
Url= "Jdbc:mysql://locahost:3306/sonar?useunicode=true&characterencoding=utf8"
Driverclassname= "Com.mysql.jdbc.Driver"
Username= "Sonar"
Password= "Sonar"
}
}
Command: gradle Clean build Sonaranalyze
Possible errors:
What went wrong:
Execution failed for task ': Sonaranalyze '.
Org.sonar.batch.bootstrapper.BootstrapException:Fail to download the file:http://locahost:9000/batch/ sonar-batch-maven-compat-5.1.jar|3bf6a6eba33643805149fd9ad258744e
New plugins
Apply plugin: ' Sonar-runner '
Sonarrunner {
sonarproperties {
property "sonar.language", "java"property "sonar.jdbc.url", "jdbc:mysql://locahost: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.language", "java"property "sonar.sources", "src"property "sonar.binaries", "build"// There is a problem when using "standard-project-layout:Sample Project" (by default)// because of the wide space property "sonar.projectKey", "jstinno:Mirror"
}
}
Command: gradle Clean build Sonarrunner
Possible error:
- What went wrong:
Execution failed for task ': Sonarrunner '.
Could not resolve all dependencies for configuration ': Sonarrunner '.
Could not find org.codehaus.sonar.runner:sonar-runner-dist:2.3.
Searched in the following locations:
file:/home/android/soft/android-sdk/extras/android/m2repository/org/codehaus/sonar/runner/sonar-runner-dist/ 2.3/sonar-runner-dist-2.3.pom
Sonar and Gradle integration