Issue Report: Compatibility Problem with SonarScanner for MSBuild and SonarQube

Environment Details:

  • SonarScanner for MSBuild Version:** 6.2
  • SonarScanner Version:** 5.0.1
  • CI Tool:** TeamCity

Description: We are experiencing failures when running SonarScanner for MSBuild as part of our CI build process on TeamCity. The issue manifests with both SonarScanner for MSBuild 6.2, as detailed below:

ERROR: Error during SonarScanner execution
java.lang.NoSuchMethodError: 'org.sonar.api.batch.AnalysisMode org.sonar.api.batch.postjob.PostJobContext.analysisMode()'
at com.uipath.sonar.plugin.hooks.DisplayIssuesInScanner.execute(DisplayIssuesInScanner.java:26)
at org.sonar.scanner.postjob.PostJobWrapper.execute(PostJobWrapper.java:49)
at org.sonar.scanner.postjob.PostJobsExecutor.execute(PostJobsExecutor.java:48)
Exception in thread "Thread-1" java.lang.NoClassDefFoundError: ch/qos/logback/classic/spi/ThrowableProxy
at ch.qos.logback.classic.spi.LoggingEvent.<init>(LoggingEvent.java:145)
at ch.qos.logback.classic.Logger.buildLoggingEventAndAppend(Logger.java:424)
at ch.qos.logback.classic.Logger.filterAndLog_0_Or3Plus(Logger.java:386)
at ch.qos.logback.classic.Logger.error(Logger.java:543)
at org.eclipse.jgit.internal.util.ShutdownHook.cleanup(ShutdownHook.java:87)
at java.base/java.lang.Thread.run(Thread.java:833)
Caused by: java.lang.ClassNotFoundException: ch.qos.logback.classic.spi.ThrowableProxy
at java.base/java.net.URLClassLoader.findClass(URLClassLoader.java:445)
at org.sonarsource.scanner.api.internal.IsolatedClassloader.loadClass(IsolatedClassloader.java:82)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:520)
... 6 more
The SonarScanner did not complete successfully
Post-processing failed. Exit code: 1

Analysis: The error indicates that the PostJobContext.analysisMode() method, which is present in the SonarQube 5.6 API, is no longer available in later versions, such as the SonarQube 9.0 API. This discrepancy suggests a compatibility issue between the SonarScanner for MSBuild versions we are using and the SonarQube server version.

Request: Guidance on how to resolve this compatibility issue. Specifically:

  1. Which versions of SonarScanner for MSBuild may be more compatible with the current version of SonarQube as a TeamCity SonarScanner for MSBuild tool/plug-in?
  2. Are there any configuration changes or updates required to align the SonarScanner with the updated API of SonarQube?

Your assistance in resolving this issue would be greatly appreciated.

Hey there.

It looks like you’re issue is coming from this plugin:

It hasn’t been updated in 5 years, so it seems no longer maintained. You may be better off uninstalling it.

Thanks Colin, yep, it works. We actually exclude the file using that plugin.