3

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
Vishal Yadav
  • 3,642
  • 3
  • 25
  • 42
Vladimir Voitekhovski
  • 1,472
  • 5
  • 21
  • 33

3 Answers3

6

Recent Sonar versions require Gradle 2.2. (2.1 might also work but I'm not sure.)

Peter Niederwieser
  • 121,412
  • 21
  • 324
  • 259
0

As a work around, i've installed sonar-runner, and analyzing my gradle project now via sonar-runner 2.4.

Vladimir Voitekhovski
  • 1,472
  • 5
  • 21
  • 33
  • In case you are not aware of it, the `sonar-runner` plugin in Gradle 2.2 can be configured to use any Sonar Runner version (such as 2.4). – Peter Niederwieser Nov 13 '14 at 11:23
  • But if i don't want to upgrade my scripts to the newest version of gradle? What to do? – Vladimir Voitekhovski Nov 13 '14 at 12:12
  • As I said, recent Sonar versions require Gradle 2.2, due to incompatible changes in the Sonar Runner API (which are outside of our control). To avoid such problems in the future, we've made the Sonar Runner API version configurable in Gradle 2.2. – Peter Niederwieser Nov 13 '14 at 14:14
0

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.

Vampire
  • 35,631
  • 4
  • 76
  • 102