在build.gradle中添加如下配置
- 旧插件 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" } }
命令: gradle clean build sonarAnalyze 可能的错误:
- 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
-
新插件 apply plugin: 'sonar-runner'
sonarRunner { sonarProperties { property "sonar.host.url", "hhttp://locahost:9000" 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"
} }
命令: gradle clean build sonarRunner 可能错误:
- 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