问题
I have updated Sonar
to the 4.5.1 LTS version, and now in my gradle task i have got the following error and can't fix it:
Fail to download libraries from server
build.gradle with sonar runner
sonarRunner {
sonarProperties {
property "sonar.host.url", "http://sonar:9000"
property "sonar.login", ""
property "sonar.password", ""
property "sonar.jdbc.url", "jdbc:mysql://sonar"
property "sonar.jdbc.driverClassName", "com.mysql.jdbc.Driver"
property "sonar.jdbc.username", "sonar"
property "sonar.jdbc.password", "sonar"
property "sonar.profile", "sonar"
property "sonar.projectName", "sonar"
property "sonar.language", "java"
property "sonar.sources", "src/main/java"
property "sonar.binaries", "build";
}
}
i've tried to write this property, but nothing happend:
toolVersion = '2.3' // default
回答1:
Recent Sonar versions require Gradle 2.2. (2.1 might also work but I'm not sure.)
回答2:
As a work around, i've installed sonar-runner, and analyzing my gradle project now via sonar-runner 2.4.
回答3:
As said before, recent SonarQube versions need Gradle 2.2 on client side.
If you cannot or do not want to update your used Gradle version, you can easily copy the Gradle Sonar Runner plugin to your buildSrc project with some slight modifications to not depend on Gradle Injection which does not work for a custom plugin.
I just did this for our project that is still using Gradle 1.12 and it works great.
来源:https://stackoverflow.com/questions/26866574/sonarrunner-with-gradle-fail-to-download-libraries-from-server