Fisher Coder
Fisher Coder

Reputation: 3576

gradle build fails cannot find sonar plugin "sonar-runner"

My gradle project cannot build. It fails with Plugin with id 'sonar-runner' not found.

Here's my build.gradle

subprojects {
    apply plugin: 'sonar-runner'
}

I've refreshed my Gradle project. Then I've deleted my ~/.gradle/caches folder, but didn't work. Then I deleted my entire ~/.gradle folder, still the same error.

Any ideas please?

It's funny that gradle build doesn't run and gives me that exception, but bash gradle build runs fine, can someone clarify the difference in between? Thanks. My setup is on Mac OSX 10.11.6.

Upvotes: 2

Views: 13353

Answers (1)

Alex Bitek
Alex Bitek

Reputation: 6559

From https://docs.sonarqube.org/display/SONARQUBE51/Analyzing+with+Gradle:

Users of Gradle Sonar or Sonar Runner Plugins ? The existing Gradle Sonar Runner and Gradle Sonar plugins, which are part of the Gradle distribution, should no longer be used (See this official note from the Gradleware team). The use of the Gradle SonarQube plugin is recommended instead.

You have to use it as described at https://plugins.gradle.org/plugin/org.sonarqube
Build script snippet for use in all Gradle versions:

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

apply plugin: "org.sonarqube"

Build script snippet for new, incubating, plugin mechanism introduced in Gradle 2.1:

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

Issue discussing this problem: https://discuss.gradle.org/t/plugin-with-id-org-sonarqube-not-found/11588/10

Upvotes: 2

Related Questions