Sonar-scanner does not respect

I just changed the sonar server to push test coverage report, while found sonar-scanner only respect the configuration from its conf/ for plug-in cache updates, it did not care about the one assigned from cmdline. Is that expected? I assumed the options from cmdline should be taken with higher priority.

sonar-scanner -Dsonar.projectKey=engine-javaupoc-jacoco-trial -Dsonar.coverage.jacoco.xmlReportPaths=javaxupoc-jacoco.xml\java -Dsonar.source= upoc\src\java -Dsonar.language=java\clxjava.jar
INFO: Scanner configuration file: D:\sonar-scanner-\bin…\conf\
INFO: Project root configuration file: NONE
INFO: SonarScanner
INFO: Java 11.0.3 AdoptOpenJDK (64-bit)
INFO: Windows 10 10.0 amd64
INFO: User cache: C:\Users\twu.sonar\cache
ERROR: SonarQube server [http://localhost:9000] can not be reached
INFO: ------------------------------------------------------------------------
INFO: ------------------------------------------------------------------------
INFO: Total time: 4.732s
INFO: Final Memory: 3M/17M
INFO: ------------------------------------------------------------------------
ERROR: Error during SonarScanner execution
org.sonarsource.scanner.api.internal.ScannerException: Unable to execute SonarScanner analysis
at org.sonarsource.scanner.api.internal.IsolatedLauncherFactory.lambda$createLauncher$0(
at java.base/ Method)
at org.sonarsource.scanner.api.internal.IsolatedLauncherFactory.createLauncher(
at org.sonarsource.scanner.api.internal.IsolatedLauncherFactory.createLauncher(
at org.sonarsource.scanner.api.EmbeddedScanner.doStart(
at org.sonarsource.scanner.api.EmbeddedScanner.start(
at org.sonarsource.scanner.cli.Main.execute(
at org.sonarsource.scanner.cli.Main.main(

Hello @wrenaashe,
The scanner should honor the parameter with the highest priority.

The INFO log where the scanner reads the default configuration file is normal
But then the scanner should override all config file parameters with what you pass on the command line. So the ERROR about trying to access http://localhost:9000 is not normal

There must be a problem in the way you pass the parameters to the scanner. Can you run the scanner again in debug (add -X cmd line option), collect the full console cmd and logs and attach to this thread.


1 Like

Thanks, @OlivierK. I somehow must type something wrong in the cmdline. Now it looked good.

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.