I have sonarqube server 4.0 and sonar-ant-task-2.1. My sonar target runs fine on my local RHEL 5 machine but as soon as I promote it to a shared RHEL 5 environment it will be run by a user whose home directory is "/dev/null" apparently. I can't change that.
I get the following error: Unable to create user cache/dev/null/.sonar/cache Caused by: java.io.IOException: Unable to create directory /dev/null/.sonar/cache
I set the following two properties:
<property name="sonar.working.directory" value="dirWhereUserHasAccess"/>
<property name="sonar.userHome" value="dirWhereUserHasAccess"/>
These properties seem to have the desired affect locally however when run on the shared environment the sonar.userHome is not used. I get the same error. It's trying to use /dev/null.
How can I get sonar to stop trying to access /dev/null for this cache?
Bug description is below. Jira task created https://jira.codehaus.org/browse/SONARPLUGINS-3349
The default Sonar cache directory path is: System.getProperty("user.home") + File.separator + ".sonar"
Set environment variable SONAR_USER_HOME
before running mvn sonar:sonar
.
Example for Bash: SONAR_USER_HOME=/my/path/.sonar mvn sonar:sonar
Unfortunately, the name SONAR_USER_HOME
is misleading -- it is not a replacement for user.home
; it is the complete cache directory path. To replicate default behavior, the following would suffice in Bash: SONAR_USER_HOME=$HOME/.sonar mvn sonar:sonar
Ref: https://github.com/SonarSource/sonarqube/blob/1f231f2cfcd47e66ca818cd1a8cbd93cc89af45d/sonar-home/src/main/java/org/sonar/home/cache/FileCacheBuilder.java
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With