Reputation: 70
I'm running SonarQube 5.1.2 on a Jenkins server with the SonarQube Scanner Plugin for Gradle.
Now I'm trying to set an automated execution for the ':sonarqube' task on the Jenkins server. I already tried the gradle project locally on my mashine and it works perfectly fine (All the test data gets uploaded to the Sonar Server). The gradle script is able to build and the ':sonarqube' task works, too. Now executing the task via Jenkins server throws the following exception:
FAILURE: Build failed with an exception.
Unable to create user cacheD:\sonar-work\user.home\cache
The problem is that there is no drive called "D:\". Is there any way to change the directory for the cache folder in SonarQube. My SONAR_USER_HOME is set to "C:.jenkins\sonar-cache" but the folder stays empty.
Upvotes: 1
Views: 3368
Reputation: 70
Finally uncovered the bug! Due to the fact, that executing the :sonarqube task locally as SYSTEM user still succeeded, it turned out that the bug was coming from the Jenkins server itself.
The cache directory is defined by the SONAR_USER_HOME variable. The problem was, that my company has a master and a slave Jenkins server. The master Jenkins had SONAR_USER_HOME defined as D:\sonar-work\user.home\.
So no matter what configuration already existed for the environment variable in Windows or the task itself (in the Jenkins configuration), the :sonarqube task was forced to use the master configuration.
By adding a global environment variable for the slave Jenkins server the problem was solved.
Upvotes: 3