Fail to download sonar-scanner-engine-shaded-8.1.0.31237-all.jar

Hello and thanks for reading,

This is how I have installed my sonar-scanner:

#!/bin/bash
set -e
SONAR_SCANNER_VERSION 4.2.0.1873
wget -O /tmp/sonar-scanner-cli-${SONAR_SCANNER_VERSION}-linux.zip "https://binaries.sonarsource.com/Distribution/sonar-scanner-cli/sonar-scanner-cli-${SONAR_SCANNER_VERSION}-linux.zip" \
    && unzip /tmp/sonar-scanner-cli-${SONAR_SCANNER_VERSION}-linux.zip -d /etc/lib/ \
    && rm /tmp/sonar-scanner-cli-${SONAR_SCANNER_VERSION}-linux.zip \
    && ln -s /etc/lib/sonar-scanner-${SONAR_SCANNER_VERSION}-linux/bin/sonar-scanner /usr/local/bin/sonar-scanner

I use it within Debian buster,

I expect the analysis to pass,

Instead I have the analysis that fail with:

 ERROR: Error during SonarQube Scanner execution
 org.sonarsource.scanner.api.internal.ScannerException: Unable to execute SonarQube
 	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 download sonar-scanner-engine-shaded-8.1.0.31237-all.jar 

I am using Version 8.1.0.31237

Any idea what is causing that error ?

Thanks a lot for your help

Hello @Kopax_Anderson,

I can’t be sure but I am suspecting that you installed the scanner in a location where the scanner has no write access. When ran, the scanner downloads on a local cache the plugins from SonarQube.
The local cache location is by default $HOME/.sonar

You can relocate the cache location by setting the environment variable $SONAR_USER_HOME to a location the scanner will be able to write. Can you check if that fixes your problem.
See also: Why is analysis “User cache” set to a strange value, and how can I set it to be cleared? :wink:

Regards