Search code examples
tfsazure-devopssonarqubeazure-devops-server-2019

How can we fix the Azure DevOps SonarQube error: Class path contains multiple SLF4J bindings


Since upgrading from SonarQube 7.x to 8, the scans have stopped working. The Build task Run Code Analysis seems to succeed with several errors like:

Calling the SonarQube Scanner...
INFO: Scanner configuration file: D:\agent6\_work\_tasks\SonarQubePrepare_15b84ca1-b62f-4a2a-a403-89b77a063157\4.8.0\classic-sonar-scanner-msbuild\sonar-scanner-4.1.0.1829\bin\..\conf\sonar-scanner.properties
INFO: Project root configuration file: D:\agent6\_work\1\.sonarqube\out\sonar-project.properties
INFO: SonarQube Scanner 4.1.0.1829
INFO: Java 1.8.0_181 Oracle Corporation (64-bit)
INFO: Windows Server 2016 10.0 amd64
INFO: User cache: C:\Windows\ServiceProfiles\NetworkService\.sonar\cache
INFO: SonarQube server 8.0.0
INFO: Default locale: "en_GB", source code encoding: "windows-1252" (analysis is platform dependent)
##[error]SLF4J: Class path contains multiple SLF4J bindings.
SLF4J: Found binding in [jar:file:/C:/Windows/ServiceProfiles/NetworkService/.sonar/cache/6abbcd30a9bf1fba1794eb6ce16eb36f/scanner-developer-8.0-all.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Class path contains multiple SLF4J bindings.
SLF4J: Found binding in [jar:file:/C:/Windows/ServiceProfiles/NetworkService/.sonar/cache/6abbcd30a9bf1fba1794eb6ce16eb36f/scanner-developer-8.0-all.jar!/org/slf4j/impl/StaticLoggerBinder.class]
##[error]SLF4J: Found binding in [jar:file:/C:/Windows/ServiceProfiles/NetworkService/.sonar/cache/9f2b37948b00b865aaf57dfd335e8d6a/sonar-scanner-engine-shaded-8.0-all.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation.
SLF4J: Found binding in [jar:file:/C:/Windows/ServiceProfiles/NetworkService/.sonar/cache/9f2b37948b00b865aaf57dfd335e8d6a/sonar-scanner-engine-shaded-8.0-all.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation.
##[error]SLF4J: Actual binding is of type [ch.qos.logback.classic.util.ContextSelectorStaticBinder]
SLF4J: Actual binding is of type [ch.qos.logback.classic.util.ContextSelectorStaticBinder]
WARN: SonarScanner will require Java 11+ to run starting in SonarQube 8.x

It eventually ends with

INFO: SCM writing changed lines (done) | time=172ms 
INFO: Analysis report generated in 1813ms, dir size=2 MB 
INFO: Analysis report compressed in 8453ms, zip size=1 MB 
INFO: Analysis report uploaded in 109ms 
INFO: ANALYSIS SUCCESSFUL, you can browse https://server/sonarqube/dashboard?id=MercuryNew&pullRequest=568 
INFO: Note that you will be able to access the updated dashboard once the server has processed the submitted analysis report INFO: More about the report processing at https://server/sonarqube/api/ce/task?id=AW7u_AxnikdkBhrYNw3V 
INFO: Analysis total time: 1:19.860 s
INFO: EXECUTION SUCCESS 
INFO: Total time: 1:21.750s 
INFO: Final Memory: 77M/2590M 
INFO: ------------------------------------------------------------------------ 
The SonarQube Scanner has finished

My java version is: "1.8.0_181" and the scanner configuration contains: wrapper.java.command=C:\Program Files\Java\jdk-12.0.1\bin\java

enter image description here

Has anyone encountered this? Is this a configuration issue or a JAVA version issue? How can I fix the scan errors?

There's another question about this, but in this case I have a brand new install.


Solution

  • From Sonarqube: Deleting the errant sonar-scanner-engine-shaded-8.0-all.jar in the lib\scanner folder solved the problem.

    enter image description here