Jenkins Pipeline is failing at sonarqube analysis stage with error "java.lang.NoSuchMethodError: 'java.io.File org.gradle.api.tasks.testing.JUnitXmlReport.getDestination()'"

Hi Team,

Jenkins Pipeline is failing at sonarqube analysis stage with error “java.lang.NoSuchMethodError: ‘java.io.File org.gradle.api.tasks.testing.JUnitXmlReport.getDestination()’”

Can you please, help me with the reason of above error and steps to resolve the error? Please, find attached Jenkins pipeline debug logs for your reference.

Please never anywhere share screenshots of text if you only want to share the text and not something additional like colors or IDE annotations. Text in images is hard to read, especially on mobile, very hard to copy, and nearly impossible to search for.

Regarding the problem, seems the SonarQube Gradle plugin you are using is not compatible with the Gradle version you are using.

Thanks a lot for the help and I will take care of suggestion you have given regarding screenshot.
I was using a sonarqube-gradle-plugin:3.3 which is supported by Gradle version 8.5, but after your suggestion I have upgraded the SonarQube Gradle plugin version from 3.3 to 5.1.0.4882 and the issue has been resolved.
Now, I am getting below error while executing the sonar stage via Jenkins pipeline. Looks like it is SonarQube/project key related permission issue. If you have any other thoughts related to the error, then please let me know. Thanks…

“Error creating bean with name ‘org.sonarsource.scanner.api.internal.IsolatedClassloader@6ae35440-org.sonar.scanner.ProjectInfo’: Unsatisfied dependency expressed through constructor parameter 0; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name ‘strong textProjectConfiguration’ defined in org.sonar.scanner.scan.ProjectConfigurationProvider: Unsatisfied dependency expressed through method ‘provide’ parameter 3; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘ProjectServerSettings’ defined in org.sonar.scanner.scan.ProjectServerSettingsProvider: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.sonar.scanner.scan.ProjectServerSettings]: Factory method ‘provide’ threw exception; nested exception is You’re not authorized to analyze this project or the project doesn’t exist on SonarQube and you’re not authorized to create it. Please contact an administrator.”

I was using a sonarqube-gradle-plugin:3.3 which is supported by Gradle version 8.5

Quite unlikely, as the method it complains about was removed in Gradle 8.0 :slight_smile:

If you have any other thoughts related to the error, then please let me know. Thanks…

This question has no longer anything to do with Gradle, you should ask in the SonarQube community forums about it instead.
But the error seems quite explicit, either you used wrong credentials that do not have permission to analyze that project, or the project key is not the expected one.

Thanks a lot Vampire Björn Kautler for the help. The issue has been resolved after changing the sonarqube-gradle-plugin version.

1 Like