"Caused by: java.lang.NullPointerException: null value" with gradle 1.10 and sonar sonarqube-4.1.


(prantorbora) #1

Hi, I am trying to use the sonar(apply plugin: ‘sonar’) from gradle(1.10 version) and getting the following exception. The sonar qube server is version 4.1, and has all default startup configurations.

The code in gradle is

sonar {
    server {
        url = "http://localhost:9000"
    }
    database {
        url = "jdbc:h2:tcp://localhost:9092/sonar"
        driverClassName = "org.h2.Driver"
        username = "sonar"
        password = "sonar"
    }
}

Exception stackstrace I am getting while running “sonarAnalyze”.

Caused by: java.lang.NullPointerException: null value

at com.google.common.base.Preconditions.checkNotNull(Preconditions.java:204)

at com.google.common.collect.ImmutableMap.entryOf(ImmutableMap.java:139)

at com.google.common.collect.ImmutableMap$Builder.put(ImmutableMap.java:178)

at com.google.common.collect.Maps.fromProperties(Maps.java:594)

at org.sonar.batch.bootstrapper.Batch.(Batch.java:59)

at org.sonar.batch.bootstrapper.Batch.(Batch.java:37)

at org.sonar.batch.bootstrapper.Batch$Builder.build(Batch.java:173)

at org.sonar.batch.Batch.execute(Batch.java:103)

at org.sonar.batch.Batch$execute.call(Unknown Source)

at org.gradle.api.plugins.sonar.internal.SonarCodeAnalyzer.execute(SonarCodeAnalyzer.groovy:51)

at org.gradle.api.plugins.sonar.internal.SonarCodeAnalyzer$execute.call(Unknown Source)

at org.gradle.api.plugins.sonar.SonarAnalyze.analyze(SonarAnalyze.groovy:49)

at org.gradle.internal.reflect.JavaMethod.invoke(JavaMethod.java:63)

at org.gradle.api.internal.project.taskfactory.AnnotationProcessingTaskFactory$StandardTaskAction.doExecute(AnnotationProcessingTaskFactory.java:219)

at org.gradle.api.internal.project.taskfactory.AnnotationProcessingTaskFactory$StandardTaskAction.execute(AnnotationProcessingTaskFactory.java:212)

at org.gradle.api.internal.project.taskfactory.AnnotationProcessingTaskFactory$StandardTaskAction.execute(AnnotationProcessingTaskFactory.java:201)

at org.gradle.api.internal.AbstractTask$TaskActionWrapper.execute(AbstractTask.java:533)

at org.gradle.api.internal.AbstractTask$TaskActionWrapper.execute(AbstractTask.java:516)

at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeAction(ExecuteActionsTaskExecuter.java:80)

at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:61)

… 49 more

Any help is appreciated.

Thanks, -PB


(Peter Niederwieser) #2

Recent versions of Sonar require the ‘sonar-runner’ plugin. See the Gradle User Guide for details.


(prantorbora) #3

Thanks, that worked.