Gradle 2.2 nightly sonarRunner task fails with toolVersion = "2.4"

I feel like I’m piling on with another sonarRunner issue in 2.2 nightly.

If I use the new toolVersion = “2.4” as in the gradle 2.2 nightly release notes, gradle sonarRunner task fails. If I instead set this to toolVersion = “2.3” (which I understand gradle defaults to), then sonarRunner task completes.

When toolVersion is set to 2.4, the failure is happening in the sonar runner code.

ERROR: Error during Sonar runner execution
java.lang.NullPointerException
        at java.util.Hashtable.put(Hashtable.java:514)
        at org.sonar.runner.Conf.initRootProjectBaseDir(Conf.java:90)
        at org.sonar.runner.Conf.loadProjectProperties(Conf.java:79)
        at org.sonar.runner.Conf.properties(Conf.java:52)
        at org.sonar.runner.Main.executeTask(Main.java:70)
        at org.sonar.runner.Main.execute(Main.java:59)
        at org.sonar.runner.Main.main(Main.java:53)

In Conf.java:89 the code gets a -Dproject.home from the sonarRunner.jar command-line and uses it as the the sonar.projectBaseDir rather than the value that is actually IN sonar-project.properties. Strange

I can get it to work manually if I add -Dproject.home to the command-line that gradle is generating for the sonarRunner task and set it to the value of sonar.projectBaseDir in sonar-project.properties. For example:

C:\Program Files\Java\jdk1.7.0_67\bin\java.exe -Dproject.settings=J:\git\gradledemo\access\build\tmp\sonarRunner\sonar-project.properties -Xmx1024m -Dfile.encoding=windows-1252 -Duser.country=US -Duser.language=en -Duser.variant -cp C:\Users\bradthurber.gradle\caches\modules-2\files-2.1\org.codehaus.sonar.runner\sonar-runner-dist.42482668102eb7f288dadd774658b58e7175c063\sonar-runner-dist-2.4.jar org.sonar.runner.Main -Dproject.home=J:\git\gradledemo\access

I don’t know if the right solution for gradle is to add this parameter to the sonarRunner command line or not. I’m very much a sonar novice and it seems strange that the sonar code would ignore the sonar.projectBaseDir value.

Brad

I’ve fixed this. Will be in the next nightly build.

Thanks for the report!

Luke,

This appears fixed in “2.2-20140927220014+0000”

Tested with sonar runner 2.4 against just-released sonarQube 4.4.1

Brad

Great, thanks for confirming.