Could not resolve org.sonarsource.scanner.gradle:sonarqube-gradle-plugin

Must-share information (formatted with Markdown):

  • sonarqube gradle plugin 4.4.1.3373
  • get a successful build from gradle and azure devops
  • add many repositories to download the correct artifiact

Hi,

Doing the upgrade to gradle 8 and sonarqube 4.x, I’m trying to build wars using gradle and I got the following errors during a build:

 > Could not resolve all files for configuration ':classpath'.
    > Could not resolve org.sonarsource.scanner.gradle:sonarqube-gradle-plugin:4.4.1.3373.
      Required by:
          project : > org.sonarqube:org.sonarqube.gradle.plugin:4.4.1.3373
       > No matching variant of org.sonarsource.scanner.gradle:sonarqube-gradle-plugin:4.4.1.3373 was found. The consumer was configured to find a library for use during runtime, compatible with Java 8, packaged as a jar, and its dependencies declared externally, as well as attribute 'org.gradle.plugin.api-version' with value '8.4' but:
           - Variant 'apiElements' capability org.sonarsource.scanner.gradle:sonarqube-gradle-plugin:4.4.1.3373 declares a library, packaged as a jar, and its dependencies declared externally:
               - Incompatible because this component declares a component for use during compile-time, compatible with Java 11 and the consumer needed a component for use during runtime, compatible with Java 8
               - Other compatible attribute:
                   - Doesn't say anything about org.gradle.plugin.api-version (required '8.4')
           - Variant 'javadocElements' capability org.sonarsource.scanner.gradle:sonarqube-gradle-plugin:4.4.1.3373 declares a component for use during runtime, and its dependencies declared externally:
               - Incompatible because this component declares documentation and the consumer needed a library
               - Other compatible attributes:
                   - Doesn't say anything about its target Java version (required compatibility with Java 8)
                   - Doesn't say anything about its elements (required them packaged as a jar)
                   - Doesn't say anything about org.gradle.plugin.api-version (required '8.4')
           - Variant 'runtimeElements' capability org.sonarsource.scanner.gradle:sonarqube-gradle-plugin:4.4.1.3373 declares a library for use during runtime, packaged as a jar, and its dependencies declared externally:
               - Incompatible because this component declares a component, compatible with Java 11 and the consumer needed a component, compatible with Java 8
               - Other compatible attribute:
                   - Doesn't say anything about org.gradle.plugin.api-version (required '8.4')
           - Variant 'sourcesElements' capability org.sonarsource.scanner.gradle:sonarqube-gradle-plugin:4.4.1.3373 declares a component for use during runtime, and its dependencies declared externally:
               - Incompatible because this component declares documentation and the consumer needed a library
               - Other compatible attributes:
                   - Doesn't say anything about its target Java version (required compatibility with Java 8)
                   - Doesn't say anything about its elements (required them packaged as a jar)
                   - Doesn't say anything about org.gradle.plugin.api-version (required '8.4')

I have tried to add many repositories as possible but I can’t understand this error message.

The plugin is declared using:

plugins {
    ...
    id("org.sonarqube") version "4.4.1.3373"
}

Any idea?

Thanks,
Best regards

HI,

Welcome to the community!

I suspect this is the problem:

You’re going to need to run analysis with Java 17. You can still compile with or to Java 8. But analysis needs Java 17.

 
HTH,
Ann