Why is analysis “User cache” set to a strange value, and how can I set it to be cleared?

  • SonarQube 7.2.1, Scanner org.sonarsource.scanner.maven sonar-maven-plugin:3.6.0.1398
  • command-line invocation: mvn -B -U org.sonarsource.scanner.maven:sonar-maven-plugin:3.6.0.1398:sonar
  • result is
15:32:51 [ERROR] Failed to execute goal org.sonarsource.scanner.maven:sonar-maven-plugin:3.6.0.1398:sonar (default-cli) on project udf-id-authority: Unable to execute SonarQube: Fail to download sonar-scanner-engine-shaded-7.2.1-all.jar to ?/.sonar/cache/_tmp/fileCache4212163220525611418.tmp: EOFException -> [Help 1]

Question is, why is the “User cache” set to a strange value (?/.sonar/cache/_tmp/...), and how can I set it to be cleared?

Hi there,

The “user cache” should be located inside the user directory. Looks like you have a misconfigured user.home system property and it’s using ?, which is an invalid path.
You can overwrite it it by exporting SONAR_USER_HOME before running the scanner.
For example:
export SONAR_USER_HOME=/home/myusername

export SONAR_USER_HOME=/home/jenkins/workspace/danube-model-jenga_PR-97-J2LDO6CVEBDWOKFXY4HIGTNXR625R52IWEHFANTXQLEWVSVLN6WQ and still ended up failing with:

18:12:39 [INFO] Downloaded from oss.sonatype.org: https://oss.sonatype.org/content/groups/staging/org/sonarsource/scanner/api/sonar-scanner-api/2.12.0.1661/sonar-scanner-api-2.12.0.1661.jar (601 kB at 695 kB/s)
18:12:39 [INFO] Downloading from central: https://repo.maven.apache.org/maven2/org/sonatype/plexus/plexus-sec-dispatcher/1.4/plexus-sec-dispatcher-1.4.jar
18:12:39 [INFO] Downloaded from central: https://repo.maven.apache.org/maven2/org/sonatype/plexus/plexus-sec-dispatcher/1.4/plexus-sec-dispatcher-1.4.jar (28 kB at 1.2 MB/s)
18:12:39 [INFO] User cache: ?/.sonar/cache
18:12:58 [INFO] ------------------------------------------------------------------------
18:12:58 [INFO] Reactor Summary:
18:12:58 [INFO] 
18:12:58 [INFO] danube-model-jenga 2.9.0.99-SNAPSHOT ............... FAILURE [ 30.744 s]
18:12:58 [INFO] jenga-model-parser ................................. SKIPPED
18:12:58 [INFO] jenga-model ........................................ SKIPPED
18:12:58 [INFO] jenga-ext-model .................................... SKIPPED
18:12:58 [INFO] jenga-model-demo ................................... SKIPPED
18:12:58 [INFO] jenga-containers ................................... SKIPPED
18:12:58 [INFO] jenga-xsd-update 2.9.0.99-SNAPSHOT ................. SKIPPED
18:12:58 [INFO] ------------------------------------------------------------------------
18:12:58 [INFO] BUILD FAILURE
18:12:58 [INFO] ------------------------------------------------------------------------
18:12:58 [INFO] Total time: 32.983 s
18:12:58 [INFO] Finished at: 2019-02-28T02:12:57Z
18:12:58 [INFO] ------------------------------------------------------------------------
18:12:58 [ERROR] Failed to execute goal org.sonarsource.scanner.maven:sonar-maven-plugin:3.6.0.1398:sonar (default-cli) on project danube-model-jenga: Unable to execute SonarQube: Fail to download sonar-scanner-engine-shaded-7.2.1-all.jar to ?/.sonar/cache/_tmp/fileCache4641857897023142769.tmp: EOFException -> [Help 1]
18:12:58 [ERROR] 

So it turns out the missing dependency lives on the server: /opt/sonarqube/lib/scanner/sonar-scanner-engine-shaded-7.2.1-all.jar so how can I get it to be recognized by maven when I invoke the build?