Set cache location for sonar-scanner

Currently sonar-scanner always use ~/.sonar/cache as cache directory (along with .scannerwork). It does makes sense to cache both of those directories for CI/CD pipelines, but most of them does not allow to cache directories outside of working dir.

It would be great to have an option to set cache location like so:

sonar-scanner -Dcache=.cache


you’re right, it seems this option is missing.
Sonarlint has such an environment variable = SONARLINT_USER_HOME
For Sonar scanner i only know SONAR_SCANNER_HOME and SONAR_SCANNER_OPTS
If there ain’t a similar environment variable for Sonar scanner you might use a symbolic link !?



You can use SONAR_USER_HOME. This will change location of ~/.sonar.

Hi @Julien_HENRY,

is this mentioned in Sonarqube documentation, didn’t find an entry ?