sonar-scanner-cli-docker icon indicating copy to clipboard operation
sonar-scanner-cli-docker copied to clipboard

Syntax error

Open HakimiX opened this issue 3 years ago • 0 comments

Please ensure your issue adheres to the following guidelines:

  • [x] Please check the problem is not already reported
  • [x] Please include enough details to reproduce the problem: the command executed, the host platform, error messages or relevant logs

The DEVELOPER.md file contains sample docker commands for using the sonar-scanner-cli, but some of the examples contain syntax errors, which results in the following error when you copy/paste:

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(IsolatedLauncherFactory.java:85)
	at java.base/java.security.AccessController.doPrivileged(Native Method)
	at org.sonarsource.scanner.api.internal.IsolatedLauncherFactory.createLauncher(IsolatedLauncherFactory.java:74)
	at org.sonarsource.scanner.api.internal.IsolatedLauncherFactory.createLauncher(IsolatedLauncherFactory.java:70)
	at org.sonarsource.scanner.api.EmbeddedScanner.doStart(EmbeddedScanner.java:185)
	at org.sonarsource.scanner.api.EmbeddedScanner.start(EmbeddedScanner.java:123)
	at org.sonarsource.scanner.cli.Main.execute(Main.java:73)
	at org.sonarsource.scanner.cli.Main.main(Main.java:61)
Caused by: java.lang.IllegalStateException: Fail to get bootstrap index from server
	at org.sonarsource.scanner.api.internal.BootstrapIndexDownloader.getIndex(BootstrapIndexDownloader.java:42)
	at org.sonarsource.scanner.api.internal.JarDownloader.getScannerEngineFiles(JarDownloader.java:58)
	at org.sonarsource.scanner.api.internal.JarDownloader.download(JarDownloader.java:53)
	at org.sonarsource.scanner.api.internal.IsolatedLauncherFactory.lambda$createLauncher$0(IsolatedLauncherFactory.java:76)
	... 7 more
Caused by: java.lang.IllegalArgumentException: Expected URL scheme 'http' or 'https' but no colon was found
	at org.sonarsource.scanner.api.internal.shaded.okhttp.HttpUrl$Builder.parse(HttpUrl.java:1332)
	at org.sonarsource.scanner.api.internal.shaded.okhttp.HttpUrl.get(HttpUrl.java:917)
	at org.sonarsource.scanner.api.internal.shaded.okhttp.Request$Builder.url(Request.java:165)
	at org.sonarsource.scanner.api.internal.ServerConnection.callUrl(ServerConnection.java:111)
	at org.sonarsource.scanner.api.internal.ServerConnection.downloadString(ServerConnection.java:99)
	at org.sonarsource.scanner.api.internal.BootstrapIndexDownloader.getIndex(BootstrapIndexDownloader.java:39)
	... 10 more
ERROR:
ERROR: Re-run SonarScanner using the -X switch to enable full debug logging.

The problem above is caused by specifying two ==, i.e.

docker run -e SONAR_HOST_URL==http://host.docker.internal:9000 -it -v "$(pwd):/usr/src" sonarsource/sonar-scanner-cli

The solution is to remove the additional = when specifying the SONAR_HOST_URL

docker run -e SONAR_HOST_URL=http://host.docker.internal:9000 ....

HakimiX avatar May 23 '22 12:05 HakimiX