Sonarqube Gradle task with Gradle 8 produces a crash on Report.getOutputLocation

  • which versions are you using (SonarQube, Scanner, Plugin, and any relevant extension)

Running plugin version: 3.5.0.2730

Gradle version:

------------------------------------------------------------
Gradle 8.0-rc-1
------------------------------------------------------------

Build time:   2022-12-29 12:32:50 UTC
Revision:     ae81f85f0e184196c188b96016eb3d9e38f60673

Kotlin:       1.8.0-RC2
Groovy:       3.0.13
Ant:          Apache Ant(TM) version 1.10.11 compiled on July 10 2021
JVM:          17.0.5 (Azul Systems, Inc. 17.0.5+8-LTS)
OS:           Mac OS X 13.1 aarch64
  • what are you trying to achieve

Reporting coverage results to sonarcloud via the Gradle plugin.

  • what have you tried so far to achieve this

Running the Gradle task sonarqube.

The problem is here:

Do not share screenshots of logs – share the text itself (bonus points for being well-formatted)!

* What went wrong:
'org.gradle.api.provider.Provider org.gradle.api.reporting.Report.getOutputLocation()'

* Try:
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.

* Exception is:
java.lang.NoSuchMethodError: 'org.gradle.api.provider.Provider org.gradle.api.reporting.Report.getOutputLocation()'
        at org.sonarqube.gradle.SonarPropertyComputer.getDestination(SonarPropertyComputer.java:423)
        at org.sonarqube.gradle.SonarPropertyComputer.configureTestReports(SonarPropertyComputer.java:286)
        at org.sonarqube.gradle.SonarPropertyComputer.extractTestProperties(SonarPropertyComputer.java:255)
        at org.sonarqube.gradle.SonarPropertyComputer.lambda$configureForJava$5(SonarPropertyComputer.java:226)
        at org.gradle.api.internal.collections.CollectionFilter$1.execute(CollectionFilter.java:59)
        at org.gradle.api.internal.DefaultDomainObjectCollection.all(DefaultDomainObjectCollection.java:161)
        at org.gradle.api.internal.DefaultDomainObjectCollection.withType(DefaultDomainObjectCollection.java:203)
        at org.sonarqube.gradle.SonarPropertyComputer.configureForJava(SonarPropertyComputer.java:222)
        at org.sonarqube.gradle.SonarPropertyComputer.addGradleDefaults(SonarPropertyComputer.java:397)
        at org.sonarqube.gradle.SonarPropertyComputer.computeSonarProperties(SonarPropertyComputer.java:99)
        at org.sonarqube.gradle.SonarPropertyComputer.computeSonarProperties(SonarPropertyComputer.java:146)
        at org.sonarqube.gradle.SonarPropertyComputer.computeSonarProperties(SonarPropertyComputer.java:146)
        at org.sonarqube.gradle.SonarPropertyComputer.computeSonarProperties(SonarPropertyComputer.java:85)
        at org.sonarqube.gradle.SonarQubePlugin.lambda$configureTask$2(SonarQubePlugin.java:99)
        at org.gradle.api.internal.provider.DefaultProvider.calculateOwnValue(DefaultProvider.java:72)
        at org.gradle.api.internal.provider.AbstractMinimalProvider.calculateValue(AbstractMinimalProvider.java:108)
        at org.gradle.api.internal.provider.TransformBackedProvider.calculateOwnValue(TransformBackedProvider.java:82)
        at org.gradle.api.internal.provider.AbstractMinimalProvider.calculateValue(AbstractMinimalProvider.java:108)
        at org.gradle.api.internal.provider.MapCollectors$EntriesFromMapProvider.collectEntries(MapCollectors.java:189)
        at org.gradle.api.internal.provider.DefaultMapProperty$CollectingSupplier.calculateValue(DefaultMapProperty.java:442)

Hello @mmoayyed thanks for reporting this.
Is there a specific reason why it is being run without using the gradle wrapper?

I believe this is run with the Gradle wrapper. The wrapper is just updated to use Gradle 8. Is there something you see in the error trace that indicates wrapper is not used?

I have not tried Gradle 8 RC2, but I am not sure that would solve this.

We don’t support Gradle 8 yet, that is the reason why I think this was not executed with via the wrapper using the ./gradlew command.

Can you please share how you are running the command?