How does one report a bug in the sonarqube gradle plugin?

There’s a bug in the SonarQube Gradle plugin. I’m seeing this stack trace when I run “./gradlew sonar” against a multi-module Gradle project:

java.lang.NoSuchMethodError: 'java.io.File org.gradle.api.tasks.testing.JUnitXmlReport.getDestination()' 
at org.sonarqube.gradle.SonarPropertyComputer.configureTestReports(SonarPropertyComputer.java:273) 
at org.sonarqube.gradle.SonarPropertyComputer.extractTestProperties(SonarPropertyComputer.java:241) 
at org.sonarqube.gradle.SonarPropertyComputer.lambda$configureForJava$4(SonarPropertyComputer.java:212) 
••• 
at org.sonarqube.gradle.SonarPropertyComputer.configureForJava(SonarPropertyComputer.java:208) 
at org.sonarqube.gradle.SonarPropertyComputer.addGradleDefaults(SonarPropertyComputer.java:384) 
at org.sonarqube.gradle.SonarPropertyComputer.computeSonarProperties(SonarPropertyComputer.java:96) 
at org.sonarqube.gradle.SonarPropertyComputer.computeSonarProperties(SonarPropertyComputer.java:143) 
at org.sonarqube.gradle.SonarPropertyComputer.computeSonarProperties(SonarPropertyComputer.java:82) 
at org.sonarqube.gradle.SonarQubePlugin.lambda$configureTask$1(SonarQubePlugin.java:96) 

I checked the Gradle API docs, and the API of the JUnixXmlReport class has changed. Specifically, it looks like the getDestination() method has been renamed to getOutputLocation().
See:
https://docs.gradle.org/current/javadoc/org/gradle/api/tasks/testing/JUnitXmlReport.html

To me, it looks like Gradle changed their API and that affected your plugin and I wanted to let you know.

I’m using Gradle 8.2.1 and the Sonar plugin: org.sonarsource.scanner.gradle:sonarqube-gradle-plugin:4.3.0.3225.

My apologies if this is the wrong forum for reporting bugs; I didn’t see a dedicated forum for reporting bugs.

Cheers,
Jon

1 Like

Hi @staycaffeinated,

Welcome to the community, and thank you for reporting!
Yes, this is the right place to report problems.

For backward compatibility, we have a mechanism to decide which method name to use.
We check the current Gradle version, and if it is greater than 7.0, we use getOutputLocation, if not getDestination.

if (GradleVersion.version("7.0").compareTo(GradleVersion.current()) <= 0) {
  return getDestinationNewApi(report);
} else {
  return getDestinationOldApi(report);
}

Can you please confirm that the GradleVersion.current() output is 8.2?

All the best,

Irina

Here’s the output for GradleVersion.current():

Gradle 8.2.1

| Irina Batinic irina.batinic SonarSourcer
August 18 |

  • | - |

Hi @staycaffeinated,

Welcome to the community, and thank you for reporting!
Yes, this is the right place to report problems.

For backward compatibility, we have a mechanism to decide which method name to use.
We check the current Gradle version, and if it is greater than 7.0, we use getOutputLocation, if not getDestination.

if (GradleVersion.version("7.0").compareTo(GradleVersion.current()) <= 0) {
  return getDestinationNewApi(report);
} else {
  return getDestinationOldApi(report);
}

Can you please confirm that the GradleVersion.current() output is 8.2?

All the best,

Irina

Hi @staycaffeinated,

Can you please update the latest version of the scanner 4.3.1.3277 and check if the problem still exists?

All the best,

Irina

That worked – and nicely, too!

Thank you for that update.

Cheers,
Jon

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.