Uncovered bug... Submitted to the user group: I believe there is a problem in sonar-ant-task-2.1->sonar-runner-2.4->sonar-runner-impl->Jars35
This line does not take into account the sonar.userHome property. When the ant-task runs the Jars35 invokes the FileCacheBuilder.build() without setting the userHome. Therefore, the builder chooses
System.getProperty("user.home") + File.separator + ".sonar"
which, in my case is not a directory where the user has r/w access (/dev/null). Therefore the analysis fails with this error:
... Caused by: java.io.IOException: Unable to create directory /dev/null/.sonar/cache at org.apache.commons.io.FileUtils.forceMkdir(FileUtils.java:1748) at org.sonar.home.cache.FileCache.createDir(FileCache.java:155) ... 30 more
I think the Jars35 class needs to be able to set the userHome or this property will not have the intended affect. Even if the user has a valid home directory some cached jars will cache into the system user.home and the rest (after being loaded with the bootstrap implementation) will be loaded into the appropriate sonar.userHome location.
FileCacheProvider using the sonar.userHome setting to build the FileCache through the FileCacheBuilder. https://github.com/SonarSource/sonar/blob/master/sonar-batch/src/main/java/org/sonar/batch/bootstrap/FileCacheProvider.java#L34
I'll update with jira issue if entered