przodownikPracy
przodownikPracy

Reputation: 547

gradle 2.14 and sonar 5.6 integration

I have a little problem with integration gradle 2.14 and sonarqube 5.6 LTS. My gradle.build look like below:

  repositories {
        mavenCentral()
        jcenter()
        maven {
            url "https://plugins.gradle.org/m2/"
          }
    }


 dependencies { 
     'org.sonarsource.scanner.gradle:sonarqube-gradle-plugin:1.2'
     ....
   }

apply plugin: 'org.sonarqube'

and gradle properties:

systemProp.sonar.host.url=http://localhost:9000
systemProp.sonar.login=sonar
systemProp.sonar.password=sonar
systemProp.sonar.sourceEncoding=UTF-8
systemProp.sonar.projectKey=some_project...
systemProp.sonar.ws.timeout=60

or even when I change on latest version plugin like this :

buildscript {
  repositories {
    maven {
      url "https://plugins.gradle.org/m2/"
    }
  }
  dependencies {
    classpath "org.sonarsource.scanner.gradle:sonarqube-gradle-plugin:2.0.1"
  }
}

apply plugin: "org.sonarqube"

I got exception (gradle with mode --info):

:sonarqube FAILED
:sonarqube (Thread[Task worker,5,main]) completed. Took 1.421 secs.

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':sonarqube'.
> Unable to load component class org.sonar.batch.bootstrap.BatchPluginInstaller

Thanks for any help.

Upvotes: 0

Views: 977

Answers (1)

As you can read on the documentation of the SonarQube Scanner for Gradle, the official and supported way to activate SonarQube analysis in your Gradle build file is simply:

plugins {
  id "org.sonarqube" version "2.0.1"
}

I've just tested and it works smoothly. So you should probably just simplify your build file to just have these lines.

Upvotes: 1

Related Questions