sonarScanner4.8 error when analys Java code

Hi all:
I met a problem when I run Jenkins java job which integrate sonar inside.This job can pull code from git and packaged with maven(Compiled with java8).But faild when analyse with sonarscanner.The infomations are as follows:

  • which versions are you using:SonarQube 9.9LTS,sonarScanner4.8
  • how is SonarQube deployed: Docker
    I have added thease sonar configurations into the jenkins pipeline:
    withSonarQubeEnv(‘sonarqube’) {
    sh "/usr/local/sonar-scanner/bin/sonar-scanner -X " +
    "-Dsonar.projectKey=demo " +
    "-Dsonar.projectName=demo " +
    "-Dsonar.sourceEncoding=UTF-8 " +
    "-Dsonar.language=java " +
    "-Dsonar.java.jdkHome=/usr/java/jdk1.8.0_73/ " +
    "-Dsonar.java.source=1.8 " +
    "-Dsonar.sources=${WORKSPACE}/platform-page-api/src " +
    "-Dsonar.java.binaries=${WORKSPACE}/platform-page-service/target/classes/ " +
    "-Dsonar.login=admin " +
    “-Dsonar.password=admin”
    }

After the maven package success,the sonarScanner report errors:
11:50:34 11:50:33.956 INFO: EXECUTION FAILURE 11:50:34 11:50:33.956 INFO: ------------------------------------------------------------------------ 11:50:34 11:50:33.956 INFO: Total time: 2.234s 11:50:34 11:50:33.985 INFO: Final Memory: 8M/34M 11:50:34 11:50:33.985 INFO: ------------------------------------------------------------------------ 11:50:34 11:50:33.985 ERROR: Error during SonarScanner execution 11:50:34 org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name ‘ClassRealm{javascript}-org.sonar.plugins.javascript.eslint.EslintBridgeServerImpl’: Unsatisfied dependency expressed through constructor parameter 4; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name ‘AnalysisTempFolder’ defined in org.sonar.scanner.analysis.AnalysisTempFolderProvider: Unsatisfied dependency expressed through method ‘provide’ parameter 0; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name ‘DefaultInputProject’ defined in org.sonar.scanner.scan.InputProjectProvider: Unsatisfied dependency expressed through method ‘provide’ parameter 2; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘ProjectReactor’ defined in org.sonar.scanner.scan.MutableProjectReactorProvider: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.sonar.api.batch.bootstrap.ProjectReactor]: Factory method ‘provide’ threw exception; nested exception is The base directory of the module ‘java-module’ does not exist: /var/lib/jenkins/workspace/sonar-demo/src/main/java 11:50:34 at org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray(ConstructorResolver.java:800) 11:50:34 at org.springframework.beans.factory.support.ConstructorResolver.autowireConstructor(ConstructorResolver.java:229) 11:50:34 at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.autowireConstructor(AbstractAutowireCapableBeanFactory.java:1372) 11:50:34 at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1228) 11:50:34 at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:582) 11:50:34 at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:542) 11:50:34 at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:335) 11:50:34 at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234) 11:50:34 at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:333) 11:50:34 at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:208) 11:50:34 at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:955) 11:50:34 at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:918) 11:50:34 at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:583) 11:50:34 at org.sonar.core.platform.SpringComponentContainer.startComponents(SpringComponentContainer.java:187) 11:50:34 at org.sonar.core.platform.SpringComponentContainer.execute(SpringComponentContainer.java:167) 11:50:34 at org.sonar.scanner.bootstrap.SpringGlobalContainer.doAfterStart(SpringGlobalContainer.java:137) 11:50:34 at org.sonar.core.platform.SpringComponentContainer.startComponents(SpringComponentContainer.java:188) 11:50:34 at org.sonar.core.platform.SpringComponentContainer.execute(SpringComponentContainer.java:167) 11:50:34 at org.sonar.batch.bootstrapper.Batch.doExecute(Batch.java:72) 11:50:34 at org.sonar.batch.bootstrapper.Batch.execute(Batch.java:66) 11:50:34 at org.sonarsource.scanner.api.internal.batch.BatchIsolatedLauncher.execute(BatchIsolatedLauncher.java:46) 11:50:34 at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) 11:50:34 at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) 11:50:34 at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) 11:50:34 at java.base/java.lang.reflect.Method.invoke(Unknown Source) 11:50:34 at org.sonarsource.scanner.api.internal.IsolatedLauncherProxy.invoke(IsolatedLauncherProxy.java:60) 11:50:34 at com.sun.proxy.$Proxy0.execute(Unknown Source) 11:50:34 at org.sonarsource.scanner.api.EmbeddedScanner.doExecute(EmbeddedScanner.java:189) 11:50:34 at org.sonarsource.scanner.api.EmbeddedScanner.execute(EmbeddedScanner.java:138) 11:50:34 at org.sonarsource.scanner.cli.Main.execute(Main.java:126) 11:50:34 at org.sonarsource.scanner.cli.Main.execute(Main.java:81) 11:50:34 at org.sonarsource.scanner.cli.Main.main(Main.java:62) 11:50:34 Caused by: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name ‘AnalysisTempFolder’ defined in org.sonar.scanner.analysis.AnalysisTempFolderProvider: Unsatisfied dependency expressed through method ‘provide’ parameter 0; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name ‘DefaultInputProject’ defined in org.sonar.scanner.scan.InputProjectProvider: Unsatisfied dependency expressed through method ‘provide’ parameter 2; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘ProjectReactor’ defined in org.sonar.scanner.scan.MutableProjectReactorProvider: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.sonar.api.batch.bootstrap.ProjectReactor]: Factory method ‘provide’ threw exception; nested exception is The base directory of the module ‘java-module’ does not exist: /var/lib/jenkins/workspace/sonar-demo/src/main/java

Hope someone can tell me how can I fix this problem,TKS~

Hey there.

Configuring the vanilla SonarScanner to analyze multi-module maven projects is error prone, and we reccomend using the SonarScanner for Maven instead.

First of all,thank you for your answers.
I have tried to copy this jenkins job workspace to another machine,ran sonarScanner4.8 to scan the code.It was success and generated a report in sonarqube.So the reason is not related to multi-module projects.
But if I ran sonarScanner4.8 which deployed in Jenkins server,it failed.The error is as follows:
ERROR: The base directory of the module ‘java-module’ does not exist: /var/lib/jenkins/workspace/sonar-demo/src/main/java
The main difference between jenkins server machine and the scan success machine is jenkins machine is java 8 and another machine is java 17.
I’m not sure if that’s the cause of this issue.
In my opinion,sonarScanner4.8 have embeded java11,So the scanner is regardless of the java version of the machine.Is it right?

The log is not correct shown by the web,the snapshot is below:

The reason has been found,because someone edit the sonarScanner config.properties,add some configuration as below:
java-module.sonar.sources=.
java-module.sonar.projectBaseDir=src/main/java
sonar.binaries=classes
After we delete thease configurations,the scan is success.
Thank you for all help~