I didn’t have this issue using the latest image prior to this date.
Thanks
sonarqube-check:
image:
name: sonarsource/sonar-scanner-cli:latest
entrypoint: [""]
variables:
SONAR_USER_HOME: "${CI_PROJECT_DIR}/.sonar" # Defines the location of the analysis task cache
GIT_DEPTH: "0" # Tells git to fetch all the branches of the project, required by the analysis task
cache:
key: "${CI_JOB_NAME}"
paths:
- .sonar/cache
script:
- sonar-scanner
allow_failure: true
only:
- merge_requests
- main
Hi , there is an issue during project analysis in SonarQube related to Cobertura 2.0 plugin, does anyone faced similar issue ?
Plugin version : Cobertura 2.0 (cobertura)
Sonarqube version 10.2.1
SonarScanner 5.0.1.3006
ERROR: Error during SonarScanner execution
java.lang.NoClassDefFoundError: com/google/common/collect/ImmutableList
at org.sonar.plugins.cobertura.CoberturaPlugin.getExtensions(CoberturaPlugin.java:35)
at org.sonar.plugins.cobertura.CoberturaPlugin.define(CoberturaPlugin.java:50)
at org.sonar.scanner.bootstrap.ExtensionInstaller.install(ExtensionInstaller.java:57)
at org.sonar.scanner.scan.SpringProjectScanContainer.addScannerExtensions(SpringProjectScanContainer.java:323)
at org.sonar.scanner.scan.SpringProjectScanContainer.doBeforeStart(SpringProjectScanContainer.java:154)
at org.sonar.core.platform.SpringComponentContainer.startComponents(SpringComponentContainer.java:186)
at org.sonar.core.platform.SpringComponentContainer.execute(SpringComponentContainer.java:167)
at org.sonar.scanner.bootstrap.SpringGlobalContainer.doAfterStart(SpringGlobalContainer.java:139)
at org.sonar.core.platform.SpringComponentContainer.startComponents(SpringComponentContainer.java:188)
at org.sonar.core.platform.SpringComponentContainer.execute(SpringComponentContainer.java:167)
at org.sonar.batch.bootstrapper.Batch.doExecute(Batch.java:71)
at org.sonar.batch.bootstrapper.Batch.execute(Batch.java:65)
at org.sonarsource.scanner.api.internal.batch.BatchIsolatedLauncher.execute(BatchIsolatedLauncher.java:46)
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.sonarsource.scanner.api.internal.IsolatedLauncherProxy.invoke(IsolatedLauncherProxy.java:60)
at jdk.proxy1/jdk.proxy1.$Proxy0.execute(Unknown Source)
at org.sonarsource.scanner.api.EmbeddedScanner.doExecute(EmbeddedScanner.java:189)
at org.sonarsource.scanner.api.EmbeddedScanner.execute(EmbeddedScanner.java:138)
at org.sonarsource.scanner.cli.Main.execute(Main.java:126)
at org.sonarsource.scanner.cli.Main.execute(Main.java:81)
at org.sonarsource.scanner.cli.Main.main(Main.java:62)
Caused by: java.lang.ClassNotFoundException: com.google.common.collect.ImmutableList
at org.sonar.classloader.ParentFirstStrategy.loadClass(ParentFirstStrategy.java:39)
at org.sonar.classloader.ClassRealm.loadClass(ClassRealm.java:87)
at org.sonar.classloader.ClassRealm.loadClass(ClassRealm.java:76)
There must be something about these very old community-supported plugins that isn’t playing nice with the latest version of the SonarScanner CLI Docker image.
There’s probably not much that can be done. These plugins (Cobertura and NDepend) haven’t been updated for 6 and 8 years respectively. I doubt we would make adjustments to the image specifically to support these very old, unmaintained plugins.
At the same time, in case this is indicative of some larger issue, I’m going to flag this for attention.
I’d have to see the full stack trace to tell you which one specifically, but assuming your stack trace is indeed the same; a plugin is probably involved.
Could you share the full stack trace of the issue, as @krishna and @Malgorzata did?
Would you mind clearing the cache folder (.sonar/cache), as we changed the user running the analysis to a non-root user, and I suspect this error might be caused by a permission issue.
The cache will be recreated during the next analysis.
Also be sure that the user 1000 has permission to write on this folder.