Sonarqube error during sonarqube analysis in .Net - pass only using sonar.scanner.useSonarScannerCLI

Hey Martin, we got another error from the sonarqube sonnar.

See bellow:

#  -Dsonar.cpd.exclusions="**/__test__/**,**/*.spec.*,**/*.test.*"
  #  -Dsonar.coverage.exclusions="**/__test__/**,**/*.spec.*,**/*.test.*"
  
  # Only use branch input if it is the same as the default branch, otherwise let sonar determine the branch name
  # For tags we must use the default branch name since we do not run analysis on the default branch
  if [ "ci/config-env" == "main" ]; then
    branch_param="-Dsonar.branch.name=ci/config-env"
  else
    branch_param=""
  fi
  
  sonar-scanner \
    -Dsonar.projectKey="XXXXXX" \
    -Dsonar.projectName="XXXXXX" \
    -Dsonar.projectVersion="XXXXXX" \
    -Dsonar.host.url="https://XXXXXX" \
    -Dsonar.token="***" \
    -Dsonar.sources="." \
    -Dsonar.exclusions="**/dist/**,**/node_modules/**,**/TestResults/**,**/__test__/**,**/*.spec.*,**/*.test.*,*.config.*,**/__mocks__/**,**/i18n/**" \
    -Dsonar.tests="." \
    -Dsonar.test.inclusions="**/__test__/**,**/*.spec.*,**/*.test.*,**/__mocks__/**" \
    -Dsonar.test.exclusions="**/dist/**,**/node_modules/**,**/TestResults/**" \
    -Dsonar.qualitygate.wait=true \
    -Dsonar.dependencyCheck.htmlReportPath="./TestResults/dependency-check-report.html" \
    -Dsonar.dependencyCheck.jsonReportPath="./TestResults/dependency-check-report.json" \
    -Dsonar.dependencyCheck.summarize=true \
    -Dsonar.javascript.lcov.reportPaths="./TestResults/coverage/lcov.info" \
    -Dsonar.junit.reportPaths="./TestResults/junit.xml" \
    $branch_param
  shell: /usr/bin/bash --noprofile --norc -e -o pipefail {0}
env:
    GITHUB_APP_TOKEN: ***
    JAVA_HOME: /home/runner/_work/_tool/Java_Temurin-Hotspot_jre/21.0.8-9.0.LTS/x64
    JAVA_HOME_21_X64: /home/runner/_work/_tool/Java_Temurin-Hotspot_jre/21.0.8-9.0.LTS/x64
[INFO]  Bootstrapper: Retrieving info from "package.json" file
[INFO]  Bootstrapper: Platform: linux x64
[INFO]  Bootstrapper: Server URL: https://sonarqube.blip.tools
[INFO]  Bootstrapper: Version: 4.3.1
[INFO]  Bootstrapper: SonarQube server version: 10.7.0
[INFO]  Bootstrapper: JRE provisioning is supported
[INFO]  Bootstrapper: Using JRE from the cache
node:events:491
      throw er; // Unhandled 'error' event
      ^

Error: spawn /home/runner/.sonar/cache/bcb1b7b8ad68c93093f09b591b7cb17161d39891f7d29d33a586f5a328603707/OpenJDK17U-jre_x64_linux_hotspot_17.0.11_9.tar.gz_extracted/jdk-17.0.11+9-jre/bin/java ENOENT
    at Process.ChildProcess._handle.onexit (node:internal/child_process:285:19)
    at onErrorNT (node:internal/child_process:485:16)
    at processTicksAndRejections (node:internal/process/task_queues:83:21)
Emitted 'error' event on ChildProcess instance at:
    at Process.ChildProcess._handle.onexit (node:internal/child_process:291:12)
    at onErrorNT (node:internal/child_process:485:16)
    at processTicksAndRejections (node:internal/process/task_queues:83:21) {
  errno: -2,
  code: 'ENOENT',
  syscall: 'spawn /home/runner/.sonar/cache/bcb1b7b8ad68c93093f09b591b7cb17161d39891f7d29d33a586f5a328603707/OpenJDK17U-jre_x64_linux_hotspot_17.0.11_9.tar.gz_extracted/jdk-17.0.11+9-jre/bin/java',
  path: '/home/runner/.sonar/cache/bcb1b7b8ad68c93093f09b591b7cb17161d39891f7d29d33a586f5a328603707/OpenJDK17U-jre_x64_linux_hotspot_17.0.11_9.tar.gz_extracted/jdk-17.0.11+9-jre/bin/java',
  spawnargs: [
    '-jar',
    '/home/runner/.sonar/cache/d5653c126135ff7d09813343eecfaa5f971529fd7e75aa30085a33bd426a5c6c/sonar-scanner-engine-shaded-10.7.0.96327-all.jar'
  ]
}

This is from a npm project - different from .Net but I believe is the same reason. I’m getting the logs from .net execution and asap get back to you.

Regards.