SonarScanner for Maven broken with SonarQube 9.5

We’re using SonarQube Developer Edition and after upgrading from 9.4 to 9.5 all of our scans that use SonarScanner for Maven broke with exactly the same error:

[INFO] Scanning for projects...
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Build Order:
[INFO] 
[INFO] service-pom                                             [pom]
[INFO] service                                                 [jar]
[INFO] service-migration                                       [jar]
[INFO] 
[INFO] -----------------< com.company:service-pom >------------------
[INFO] Building service-pom dependabot.maven.com.company.api.protos.1.6.229-2bd69c0-SNAPSHOT [1/3]
[INFO] --------------------------------[ pom ]---------------------------------
[INFO] 
[INFO] --- sonar-maven-plugin:3.9.1.2184:sonar (default-cli) @ service-pom ---
[INFO] User cache: /home/runner/.sonar/cache
[INFO] SonarQube version: 9.5.0.56709
[INFO] Default locale: "en", source code encoding: "UTF-8"
[INFO] Load global settings
[INFO] Load global settings (done) | time=438ms
[INFO] Server id: 8E0EBE95-AXyDumT00ooivwvgUXZn
[INFO] User cache: /home/runner/.sonar/cache
[INFO] Load/download plugins
[INFO] Load plugins index
[INFO] Load plugins index (done) | time=135ms
[INFO] Load/download plugins (done) | time=8808ms
[INFO] Loaded core extensions: developer-scanner
[INFO] Process project properties
[INFO] Process project properties (done) | time=12ms
[INFO] Execute project builders
[INFO] Execute project builders (done) | time=2ms
[INFO] Project key: com.company:service-pom
[INFO] Base dir: /home/runner/work/company-service/company-service
[INFO] Working dir: /home/runner/work/company-service/company-service/target/sonar
[INFO] Load project settings for component key: 'com.company:service-pom'
[INFO] Load project settings for component key: 'com.company:service-pom' (done) | time=103ms
[INFO] Load project branches
[INFO] Load project branches (done) | time=105ms
[INFO] Load project pull requests
[INFO] Load project pull requests (done) | time=136ms
[INFO] Load branch configuration
[INFO] Detected branch/PR in 'GitHub Action'
[INFO] Auto-configuring pull request '133'
[INFO] Load branch configuration (done) | time=6ms
[INFO] Auto-configuring with CI 'Github Actions'
[INFO] Load quality profiles
[INFO] Load quality profiles (done) | time=149ms
[INFO] Load active rules
[INFO] Load active rules (done) | time=3978ms
[INFO] Load analysis cache
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary for service-pom dependabot.maven.com.company.api.protos.1.6.229-2bd69c0-SNAPSHOT:
[INFO] 
[INFO] service-pom ............................. FAILURE [ 27.558 s]
[INFO] service ................................. SKIPPED
[INFO] service-migration ....................... SKIPPED
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  28.167 s
[INFO] Finished at: 2022-06-23T09:57:42Z
[INFO] ------------------------------------------------------------------------
---------------------------------------------------
constituent[0]: file:/usr/share/apache-maven-3.8.6/conf/logging/
constituent[1]: file:/usr/share/apache-maven-3.8.6/lib/plexus-cipher-2.0.jar
constituent[2]: file:/usr/share/apache-maven-3.8.6/lib/maven-artifact-3.8.6.jar
constituent[3]: file:/usr/share/apache-maven-3.8.6/lib/plexus-interpolation-1.26.jar
constituent[4]: file:/usr/share/apache-maven-3.8.6/lib/maven-resolver-api-1.6.3.jar
constituent[5]: file:/usr/share/apache-maven-3.8.6/lib/maven-resolver-provider-3.8.6.jar
constituent[6]: file:/usr/share/apache-maven-3.8.6/lib/maven-model-3.8.6.jar
constituent[7]: file:/usr/share/apache-maven-3.8.6/lib/maven-embedder-3.8.6.jar
constituent[8]: file:/usr/share/apache-maven-3.8.6/lib/wagon-provider-api-3.5.1.jar
constituent[9]: file:/usr/share/apache-maven-3.8.6/lib/maven-resolver-connector-basic-1.6.3.jar
constituent[10]: file:/usr/share/apache-maven-3.8.6/lib/maven-builder-support-3.8.6.jar
constituent[11]: file:/usr/share/apache-maven-3.8.6/lib/plexus-component-annotations-2.1.0.jar
constituent[12]: file:/usr/share/apache-maven-3.8.6/lib/maven-resolver-spi-1.6.3.jar
constituent[13]: file:/usr/share/apache-maven-3.8.6/lib/maven-settings-3.8.6.jar
constituent[14]: file:/usr/share/apache-maven-3.8.6/lib/maven-model-builder-3.8.6.jar
constituent[15]: file:/usr/share/apache-maven-3.8.6/lib/maven-slf4j-provider-3.8.6.jar
constituent[16]: file:/usr/share/apache-maven-3.8.6/lib/javax.inject-1.jar
constituent[17]: file:/usr/share/apache-maven-3.8.6/lib/commons-io-2.6.jar
constituent[18]: file:/usr/share/apache-maven-3.8.6/lib/jansi-2.4.0.jar
constituent[19]: file:/usr/share/apache-maven-3.8.6/lib/wagon-http-3.5.1-shaded.jar
constituent[20]: file:/usr/share/apache-maven-3.8.6/lib/wagon-file-3.5.1.jar
constituent[21]: file:/usr/share/apache-maven-3.8.6/lib/plexus-utils-3.3.1.jar
constituent[22]: file:/usr/share/apache-maven-3.8.6/lib/maven-resolver-impl-1.6.3.jar
constituent[23]: file:/usr/share/apache-maven-3.8.6/lib/maven-repository-metadata-3.8.6.jar
constituent[24]: file:/usr/share/apache-maven-3.8.6/lib/maven-core-3.8.6.jar
constituent[25]: file:/usr/share/apache-maven-3.8.6/lib/maven-resolver-util-1.6.3.jar
constituent[26]: file:/usr/share/apache-maven-3.8.6/lib/maven-shared-utils-3.3.4.jar
constituent[27]: file:/usr/share/apache-maven-3.8.6/lib/maven-compat-3.8.6.jar
constituent[28]: file:/usr/share/apache-maven-3.8.6/lib/maven-plugin-api-3.8.6.jar
constituent[29]: file:/usr/share/apache-maven-3.8.6/lib/org.eclipse.sisu.inject-0.3.5.jar
constituent[30]: file:/usr/share/apache-maven-3.8.6/lib/guice-4.2.2-no_aop.jar
Error: Exception in thread "main" java.lang.NoClassDefFoundError: com/google/common/collect/LinkedListMultimap$1KeySetImpl
constituent[31]: file:/usr/share/apache-maven-3.8.6/lib/plexus-sec-dispatcher-2.0.jar
	at com.google.common.collect.LinkedListMultimap.createKeySet(LinkedListMultimap.java:754)
	at com.google.common.collect.AbstractMultimap.keySet(AbstractMultimap.java:167)
	at com.google.common.collect.LinkedListMultimap.keySet(LinkedListMultimap.java:98)
	at org.sonar.core.util.ContextException.format(ContextException.java:148)
	at org.sonar.core.util.ContextException.getMessage(ContextException.java:135)
	at org.apache.maven.exception.DefaultExceptionHandler.getMessage(DefaultExceptionHandler.java:277)
	at org.apache.maven.exception.DefaultExceptionHandler.handle(DefaultExceptionHandler.java:124)
	at org.apache.maven.exception.DefaultExceptionHandler.handleException(DefaultExceptionHandler.java:96)
	at org.apache.maven.cli.MavenCli.execute(MavenCli.java:976)
	at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:293)
	at org.apache.maven.cli.MavenCli.main(MavenCli.java:196)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.base/java.lang.reflect.Method.invoke(Method.java:568)
	at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:282)
	at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:225)
	at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:406)
	at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:347)
Caused by: java.lang.ClassNotFoundException: com.google.common.collect.LinkedListMultimap$1KeySetImpl
	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)
	... 19 more
constituent[32]: file:/usr/share/apache-maven-3.8.6/lib/commons-lang3-3.8.1.jar
constituent[33]: file:/usr/share/apache-maven-3.8.6/lib/org.eclipse.sisu.plexus-0.3.5.jar
constituent[34]: file:/usr/share/apache-maven-3.8.6/lib/jcl-over-slf4j-1.7.36.jar
constituent[35]: file:/usr/share/apache-maven-3.8.6/lib/slf4j-api-1.7.36.jar
constituent[36]: file:/usr/share/apache-maven-3.8.6/lib/commons-cli-1.4.jar
constituent[37]: file:/usr/share/apache-maven-3.8.6/lib/maven-resolver-transport-wagon-1.6.3.jar
constituent[38]: file:/usr/share/apache-maven-3.8.6/lib/guava-25.1-android.jar
constituent[39]: file:/usr/share/apache-maven-3.8.6/lib/javax.annotation-api-1.2.jar
constituent[40]: file:/usr/share/apache-maven-3.8.6/lib/maven-settings-builder-3.8.6.jar
---------------------------------------------------
Error: Process completed with exit code 1.

I searched these forums as well as JIRA tickets and didn’t find anything relevant. Reverting back to 9.4 resolved the issue, but since there are no relevant bug reports, we have no idea when it’s safe to ugrade.

Hi,

Welcome to the community!

Given the last line before the error, I think you were probably falling prey to this:

https://jira.sonarsource.com/browse/SONARJAVA-4267

We plan to fix this in 9.6. No word yet on whether we’ll patch 9.5.

Thanks for your report. It will weigh in the decision.

 
Thx!
Ann

Thank you for a prompt reply. We’re fine waiting it out until 9.6 release and will look for the ticket number in the release notes.

1 Like

Hello,

We have the exact same behavior :frowning:
Any plans to mitigate? or we must downgrade to 9.4?

Xavier

Xavier, there’s a workaround in the ticket. Does it not help?

I wouldn’t know as we ended up downgrading…

1 Like

Yes, just adding <sonar.analysisCache.enabled>false</sonar.analysisCache.enabled> at the root pom.xml solve the problem.

1 Like