Sonarqube plug in not found

sonarqube
plugins

(John) #1

I am currently trying to upgrade my gradle to a new version (2.14.1 to latest gradle) and originally we used sonar-runner in 2.14.1, and after changing the wrapper to 4.8.1, resulted in ‘Plugin with id ‘sonar-runner’ not found’ so I’ve decided to just upgrade to sonarqube as well since

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.

However, I’ve tried using both methods stated here https://discuss.gradle.org/t/plugin-with-id-org-sonarqube-not-found/11588, as well as the solution at the end, but I am getting

Parallel execution with configuration on demand is an incubating feature.
Download https://plugins.gradle.org/m2/org/sonarsource/scanner/gradle/sonarqube-gradle-plugin/2.0.1/sonarqube-gradle-plugin-2.0.1.pom
Download https://plugins.gradle.org/m2/com/google/guava/guava/17.0/guava-17.0.pom1.pom
Download https://plugins.gradle.org/m2/org/sonarsource/scanner/api/sonar-scanner-api/2.6/sonar-scanner-api-2.6.pom
Download https://plugins.gradle.org/m2/com/google/guava/guava-parent/17.0/guava-parent-17.0.pom
Download https://plugins.gradle.org/m2/org/sonarsource/scanner/api/sonar-scanner-api-parent/2.6/sonar-scanner-api-parent-2.6.pom
Download https://plugins.gradle.org/m2/org/sonarsource/parent/parent/31/parent-31.pom
Download https://plugins.gradle.org/m2/com/google/guava/guava/17.0/guava-17.0.jar
Download https://plugins.gradle.org/m2/org/sonarsource/scanner/gradle/sonarqube-gradle-plugin/2.0.1/sonarqube-gradle-plugin-2.0.1.jar
Download https://plugins.gradle.org/m2/org/sonarsource/scanner/api/sonar-scanner-api/2.6/sonar-scanner-api-2.6.jar

FAILURE: Build failed with an exception.
...
* What went wrong:
A problem occurred evaluating script.
> Plugin with id 'org.sonarqube' not found.

(Marian Stránecký) #2

Hi John,
if it’s still relevant for your situation, there is a new plugin provided by SonarQube:

https://docs.sonarqube.org/display/SCAN/Analyzing+with+SonarQube+Scanner+for+Gradle
https://plugins.gradle.org/plugin/org.sonarqube

You can use it as follows (consider it be an example only):

plugins {
    id 'org.sonarqube' version '2.6.2'
}


sonarqube {
    properties {
        property "sonar.projectKey", "some-fancy-project-key"
        property "sonar.projectName", "Some Fancy Project Name"
    }
}

allprojects {
    sonarqube {
        properties {
            property "sonar.sourceEncoding", "UTF-8"
        }
    }
}

Of course, you can fallback from plugin DSL to buildscript syntax, for details see the links provided above.


(St Shadow) #3

Hi.
Seems we also observe that a plugin is missed

https://plugins.gradle.org/m2/org/sonarqube/org.sonarqube.gradle.plugin/2.6.2/ or https://plugins.gradle.org/m2/org/sonarqube/org.sonarqube.gradle.plugin/2.6/ have no JAR artifacts

And during our build we get
Caused by: org.gradle.api.resources.ResourceException: Could not get resource ' https://plugins.gradle.org/m2/org/sonarqube/org.sonarqube.gradle.plugin/2.6/org.sonarqube.gradle.plugin-2.6.jar

When I try to access https://plugins.gradle.org/m2/org/sonarqube/org.sonarqube.gradle.plugin/2.6/org.sonarqube.gradle.plugin-2.6.jar using browser I get 404


(James Justinic) #4

This is expected and correct. There should only be a marker interface (POM) at these coordinates created from the plugin ID. That marker interface declares a dependency on the actual coordinates where the plugin artifact (JAR) can be found.


(St Shadow) #5

@jjustinic what’s about 404 when trying to access https://plugins.gradle.org/m2/org/sonarqube/org.sonarqube.gradle.plugin/2.6/org.sonarqube.gradle.plugin-2.6.jar ?


(James Justinic) #6

There should not be a JAR at that location. Those coordinates are only for a marker interface (POM file).

The marker interface specifies that the JAR should be located at (which it is): https://plugins.gradle.org/m2/org/sonarsource/scanner/gradle/sonarqube-gradle-plugin/2.6/sonarqube-gradle-plugin-2.6.jar