NullPointerException for gradle integration

  • ALM used (GitHub, Bitbucket Cloud, Azure DevOps)
    Github

  • CI system used (Bitbucket Cloud, Azure DevOps, Travis CI, Circle CI
    Simple command line

  • Scanner command used when applicable (private details masked)
    gradle sonarqube

  • Languages of the repository
    Java

  • Steps to reproduce
    After adding the following into my build.gradle

plugins {
    id 'org.springframework.boot' version '2.1.4.RELEASE'
    id 'java'
    id 'idea'
    id "org.sonarqube" version "2.8"
}

sonarqube {
	properties {
		property "sonar.projectKey", "monacohq_xfinity-server"
		property "sonar.organization", "monacohq"
		property "sonar.host.url", "https://sonarcloud.io"
                property "sonar.login", "xxxxxx"
	}
}

And when I run gradle sonarqube (with or without build, or -x test, still the same error)

------------- Run sensors on project
Sensor Zero Coverage Sensor
Sensor Zero Coverage Sensor (done) | time=1ms
Sensor Java CPD Block Indexer
Sensor Java CPD Block Indexer (done) | time=42ms
SCM Publisher SCM provider for this project is: git
SCM Publisher 43 source files to be analyzed
CPD Executor 10 files had no CPD blocks
CPD Executor Calculating CPD for 18 files
:sonarqube (Thread[Task worker for ':',5,main]) completed. Took 1 mins 10.298 secs.

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':sonarqube'.
> java.lang.NullPointerException (no error message)

* Try:
Run with --debug option to get more log output. Run with --scan to get full insights.

* Exception is:
org.gradle.api.tasks.TaskExecutionException: Execution failed for task ':sonarqube'.
        at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:110)
        at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.execute(ExecuteActionsTaskExecuter.java:77)
        at org.gradle.api.internal.tasks.execution.OutputDirectoryCreatingTaskExecuter.execute(OutputDirectoryCreatingTaskExecuter.java:51)
        at org.gradle.api.internal.tasks.execution.SkipUpToDateTaskExecuter.execute(SkipUpToDateTaskExecuter.java:59)
        at org.gradle.api.internal.tasks.execution.ResolveTaskOutputCachingStateExecuter.execute(ResolveTaskOutputCachingStateExecuter.java:54)
        at org.gradle.api.internal.tasks.execution.ValidatingTaskExecuter.execute(ValidatingTaskExecuter.java:59)
        at org.gradle.api.internal.tasks.execution.SkipEmptySourceFilesTaskExecuter.execute(SkipEmptySourceFilesTaskExecuter.java:101)
        at org.gradle.api.internal.tasks.execution.FinalizeInputFilePropertiesTaskExecuter.execute(FinalizeInputFilePropertiesTaskExecuter.java:44)
        at org.gradle.api.internal.tasks.execution.CleanupStaleOutputsExecuter.execute(CleanupStaleOutputsExecuter.java:91)
        at org.gradle.api.internal.tasks.execution.ResolveTaskArtifactStateTaskExecuter.execute(ResolveTaskArtifactStateTaskExecuter.java:62)
        at org.gradle.api.internal.tasks.execution.SkipTaskWithNoActionsExecuter.execute(SkipTaskWithNoActionsExecuter.java:59)
        at org.gradle.api.internal.tasks.execution.SkipOnlyIfTaskExecuter.execute(SkipOnlyIfTaskExecuter.java:54)
        at org.gradle.api.internal.tasks.execution.ExecuteAtMostOnceTaskExecuter.execute(ExecuteAtMostOnceTaskExecuter.java:43)
        at org.gradle.api.internal.tasks.execution.CatchExceptionTaskExecuter.execute(CatchExceptionTaskExecuter.java:34)
        at org.gradle.api.internal.tasks.execution.EventFiringTaskExecuter$1.run(EventFiringTaskExecuter.java:51)
        at org.gradle.internal.operations.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:300)
        at org.gradle.internal.operations.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:292)
        at org.gradle.internal.operations.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:174)
        at org.gradle.internal.operations.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:90)
        at org.gradle.internal.operations.DelegatingBuildOperationExecutor.run(DelegatingBuildOperationExecutor.java:31)
        at org.gradle.api.internal.tasks.execution.EventFiringTaskExecuter.execute(EventFiringTaskExecuter.java:46)
        at org.gradle.execution.taskgraph.LocalTaskInfoExecutor.execute(LocalTaskInfoExecutor.java:42)
        at org.gradle.execution.taskgraph.DefaultTaskExecutionGraph$BuildOperationAwareWorkItemExecutor.execute(DefaultTaskExecutionGraph.java:277)
        at org.gradle.execution.taskgraph.DefaultTaskExecutionGraph$BuildOperationAwareWorkItemExecutor.execute(DefaultTaskExecutionGraph.java:262)
        at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$ExecutorWorker$1.execute(DefaultTaskPlanExecutor.java:135)
        at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$ExecutorWorker$1.execute(DefaultTaskPlanExecutor.java:130)
        at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$ExecutorWorker.execute(DefaultTaskPlanExecutor.java:200)
        at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$ExecutorWorker.executeWithWork(DefaultTaskPlanExecutor.java:191)
        at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$ExecutorWorker.run(DefaultTaskPlanExecutor.java:130)
        at org.gradle.internal.concurrent.ExecutorPolicy$CatchAndRecordFailures.onExecute(ExecutorPolicy.java:63)
        at org.gradle.internal.concurrent.ManagedExecutorImpl$1.run(ManagedExecutorImpl.java:46)
        at org.gradle.internal.concurrent.ThreadFactoryImpl$ManagedThreadRunnable.run(ThreadFactoryImpl.java:55)
Caused by: java.lang.NullPointerException
        at org.sonar.scanner.report.ComponentsPublisher.convert(ComponentsPublisher.java:89)
        at org.sonar.scanner.report.ComponentsPublisher.publish(ComponentsPublisher.java:54)
        at org.sonar.scanner.report.ReportPublisher.generateReportFile(ReportPublisher.java:163)
        at org.sonar.scanner.report.ReportPublisher.execute(ReportPublisher.java:136)
        at org.sonar.scanner.scan.ProjectScanContainer.doAfterStart(ProjectScanContainer.java:380)
        at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:122)
        at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:108)
        at org.sonar.scanner.bootstrap.GlobalContainer.doAfterStart(GlobalContainer.java:126)
        at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:122)
        at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:108)
        at org.sonar.batch.bootstrapper.Batch.doExecute(Batch.java:58)
        at org.sonar.batch.bootstrapper.Batch.execute(Batch.java:52)
        at org.sonarsource.scanner.api.internal.batch.BatchIsolatedLauncher.execute(BatchIsolatedLauncher.java:46)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at org.sonarsource.scanner.api.internal.IsolatedLauncherProxy.invoke(IsolatedLauncherProxy.java:60)
        at com.sun.proxy.$Proxy122.execute(Unknown Source)
        at org.sonarsource.scanner.api.EmbeddedScanner.doExecute(EmbeddedScanner.java:189)
        at org.sonarsource.scanner.api.EmbeddedScanner.execute(EmbeddedScanner.java:138)
        at org.sonarqube.gradle.SonarQubeTask.run(SonarQubeTask.java:100)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at org.gradle.internal.reflect.JavaMethod.invoke(JavaMethod.java:73)
        at org.gradle.api.internal.project.taskfactory.StandardTaskAction.doExecute(StandardTaskAction.java:46)
        at org.gradle.api.internal.project.taskfactory.StandardTaskAction.execute(StandardTaskAction.java:39)
        at org.gradle.api.internal.project.taskfactory.StandardTaskAction.execute(StandardTaskAction.java:26)
        at org.gradle.api.internal.AbstractTask$TaskActionWrapper.execute(AbstractTask.java:801)
        at org.gradle.api.internal.AbstractTask$TaskActionWrapper.execute(AbstractTask.java:768)
        at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter$1.run(ExecuteActionsTaskExecuter.java:131)
        at org.gradle.internal.operations.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:300)
        at org.gradle.internal.operations.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:292)
        at org.gradle.internal.operations.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:174)
        at org.gradle.internal.operations.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:90)
        at org.gradle.internal.operations.DelegatingBuildOperationExecutor.run(DelegatingBuildOperationExecutor.java:31)
        at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeAction(ExecuteActionsTaskExecuter.java:120)
        at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:99)
        ... 31 more


* Get more help at https://help.gradle.org

BUILD FAILED in 1m 10s
1 actionable task: 1 executed

The latest version of the Gradle scanner is 3.0. Can you please try with that? That is, change this line:

id "org.sonarqube" version "3.0"

Just upgraded to 3.0, stacktrace is still more or less the same

Caused by: java.lang.NullPointerException
        at org.sonar.scanner.report.ComponentsPublisher.convert(ComponentsPublisher.java:89)
        at org.sonar.scanner.report.ComponentsPublisher.publish(ComponentsPublisher.java:54)
        at org.sonar.scanner.report.ReportPublisher.generateReportFile(ReportPublisher.java:163)
        at org.sonar.scanner.report.ReportPublisher.execute(ReportPublisher.java:136)
        at org.sonar.scanner.scan.ProjectScanContainer.doAfterStart(ProjectScanContainer.java:380)
        at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:122)
        at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:108)
        at org.sonar.scanner.bootstrap.GlobalContainer.doAfterStart(GlobalContainer.java:126)
        at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:122)
        at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:108)
        at org.sonar.batch.bootstrapper.Batch.doExecute(Batch.java:58)
        at org.sonar.batch.bootstrapper.Batch.execute(Batch.java:52)
        at org.sonarsource.scanner.api.internal.batch.BatchIsolatedLauncher.execute(BatchIsolatedLauncher.java:46)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at org.sonarsource.scanner.api.internal.IsolatedLauncherProxy.invoke(IsolatedLauncherProxy.java:60)
        at com.sun.proxy.$Proxy138.execute(Unknown Source)
        at org.sonarsource.scanner.api.EmbeddedScanner.doExecute(EmbeddedScanner.java:189)
        at org.sonarsource.scanner.api.EmbeddedScanner.execute(EmbeddedScanner.java:138)
        at org.sonarqube.gradle.SonarQubeTask.run(SonarQubeTask.java:100)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at org.gradle.internal.reflect.JavaMethod.invoke(JavaMethod.java:104)
        at org.gradle.api.internal.project.taskfactory.StandardTaskAction.doExecute(StandardTaskAction.java:49)
        at org.gradle.api.internal.project.taskfactory.StandardTaskAction.execute(StandardTaskAction.java:42)
        at org.gradle.api.internal.project.taskfactory.StandardTaskAction.execute(StandardTaskAction.java:28)
        at org.gradle.api.internal.AbstractTask$TaskActionWrapper.execute(AbstractTask.java:727)
        at org.gradle.api.internal.AbstractTask$TaskActionWrapper.execute(AbstractTask.java:694)
        at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter$3.run(ExecuteActionsTaskExecuter.java:568)
        at org.gradle.internal.operations.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:402)
        at org.gradle.internal.operations.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:394)
        at org.gradle.internal.operations.DefaultBuildOperationExecutor$1.execute(DefaultBuildOperationExecutor.java:165)
        at org.gradle.internal.operations.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:250)
        at org.gradle.internal.operations.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:158)
        at org.gradle.internal.operations.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:92)
        at org.gradle.internal.operations.DelegatingBuildOperationExecutor.run(DelegatingBuildOperationExecutor.java:31)
        at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeAction(ExecuteActionsTaskExecuter.java:553)
        at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:536)
        at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.access$300(ExecuteActionsTaskExecuter.java:109)
        at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter$TaskExecution.executeWithPreviousOutputFiles(ExecuteActionsTaskExecuter.java:276)
        at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter$TaskExecution.execute(ExecuteActionsTaskExecuter.java:265)
        at org.gradle.internal.execution.steps.ExecuteStep.lambda$execute$1(ExecuteStep.java:33)
        at org.gradle.internal.execution.steps.ExecuteStep.execute(ExecuteStep.java:33)
        at org.gradle.internal.execution.steps.ExecuteStep.execute(ExecuteStep.java:26)
        at org.gradle.internal.execution.steps.CleanupOutputsStep.execute(CleanupOutputsStep.java:67)
        at org.gradle.internal.execution.steps.CleanupOutputsStep.execute(CleanupOutputsStep.java:36)
        at org.gradle.internal.execution.steps.ResolveInputChangesStep.execute(ResolveInputChangesStep.java:49)
        at org.gradle.internal.execution.steps.ResolveInputChangesStep.execute(ResolveInputChangesStep.java:34)
        at org.gradle.internal.execution.steps.CancelExecutionStep.execute(CancelExecutionStep.java:43)
        at org.gradle.internal.execution.steps.TimeoutStep.executeWithoutTimeout(TimeoutStep.java:73)
        at org.gradle.internal.execution.steps.TimeoutStep.execute(TimeoutStep.java:54)
        at org.gradle.internal.execution.steps.CatchExceptionStep.execute(CatchExceptionStep.java:34)
        at org.gradle.internal.execution.steps.CreateOutputsStep.execute(CreateOutputsStep.java:44)
        at org.gradle.internal.execution.steps.SnapshotOutputsStep.execute(SnapshotOutputsStep.java:54)
        at org.gradle.internal.execution.steps.SnapshotOutputsStep.execute(SnapshotOutputsStep.java:38)
        at org.gradle.internal.execution.steps.BroadcastChangingOutputsStep.execute(BroadcastChangingOutputsStep.java:49)
        at org.gradle.internal.execution.steps.CacheStep.executeWithoutCache(CacheStep.java:159)
        at org.gradle.internal.execution.steps.CacheStep.execute(CacheStep.java:72)
        at org.gradle.internal.execution.steps.CacheStep.execute(CacheStep.java:43)
        at org.gradle.internal.execution.steps.StoreExecutionStateStep.execute(StoreExecutionStateStep.java:44)
        at org.gradle.internal.execution.steps.StoreExecutionStateStep.execute(StoreExecutionStateStep.java:33)
        at org.gradle.internal.execution.steps.RecordOutputsStep.execute(RecordOutputsStep.java:38)
        at org.gradle.internal.execution.steps.RecordOutputsStep.execute(RecordOutputsStep.java:24)
        at org.gradle.internal.execution.steps.SkipUpToDateStep.executeBecause(SkipUpToDateStep.java:92)
        at org.gradle.internal.execution.steps.SkipUpToDateStep.lambda$execute$0(SkipUpToDateStep.java:85)
        at org.gradle.internal.execution.steps.SkipUpToDateStep.execute(SkipUpToDateStep.java:55)
        at org.gradle.internal.execution.steps.SkipUpToDateStep.execute(SkipUpToDateStep.java:39)
        at org.gradle.internal.execution.steps.ResolveChangesStep.execute(ResolveChangesStep.java:76)
        at org.gradle.internal.execution.steps.ResolveChangesStep.execute(ResolveChangesStep.java:37)
        at org.gradle.internal.execution.steps.legacy.MarkSnapshottingInputsFinishedStep.execute(MarkSnapshottingInputsFinishedStep.java:36)
        at org.gradle.internal.execution.steps.legacy.MarkSnapshottingInputsFinishedStep.execute(MarkSnapshottingInputsFinishedStep.java:26)
        at org.gradle.internal.execution.steps.ResolveCachingStateStep.execute(ResolveCachingStateStep.java:94)
        at org.gradle.internal.execution.steps.ResolveCachingStateStep.execute(ResolveCachingStateStep.java:49)
        at org.gradle.internal.execution.steps.CaptureStateBeforeExecutionStep.execute(CaptureStateBeforeExecutionStep.java:79)
        at org.gradle.internal.execution.steps.CaptureStateBeforeExecutionStep.execute(CaptureStateBeforeExecutionStep.java:53)
        at org.gradle.internal.execution.steps.ValidateStep.execute(ValidateStep.java:74)
        at org.gradle.internal.execution.steps.SkipEmptyWorkStep.lambda$execute$2(SkipEmptyWorkStep.java:78)
        at org.gradle.internal.execution.steps.SkipEmptyWorkStep.execute(SkipEmptyWorkStep.java:78)
        at org.gradle.internal.execution.steps.SkipEmptyWorkStep.execute(SkipEmptyWorkStep.java:34)
        at org.gradle.internal.execution.steps.legacy.MarkSnapshottingInputsStartedStep.execute(MarkSnapshottingInputsStartedStep.java:39)
        at org.gradle.internal.execution.steps.LoadExecutionStateStep.execute(LoadExecutionStateStep.java:40)
        at org.gradle.internal.execution.steps.LoadExecutionStateStep.execute(LoadExecutionStateStep.java:28)
        at org.gradle.internal.execution.impl.DefaultWorkExecutor.execute(DefaultWorkExecutor.java:33)
        at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeIfValid(ExecuteActionsTaskExecuter.java:192)
        ... 30 more

Hello,

Did anyone sort it out?

I am having the same problem, even with the demo repo : https://github.com/SonarSource/sonar-scanning-examples

I have changed the sonarqube version to 3.0 but it didn’t work.

Any help would be much apperciated.

Thanks

I still have the problem. Seems completely broken to me.

Anyone from support team see this???

Hi @samngmco,

What version of SonarQube are you running?
I suspect that this error originates from SonarQube and not the scanner but need you version to verify this.

Cheers,
Mark

We use SonarCloud

Ok then it looks like there is a missing file status field that is expected by the scanner.

I don’t think it’s our problem. @Fayez can’t scan even the example code. More likely a bug in the scanner.

But if you can tell them what I can do as a workaround, I am happy to apply it to make it scan.

@Fayez I’m trying to reproduce the issue with the sample code you linked, but it’s working for me:

git clone https://github.com/SonarSource/sonar-scanning-examples
cd sonar-scanning-examples/sonarqube-scanner-gradle

# edit build.gradle, adding configuration as in first post, and then:
./gradlew sonarqube

This works fine. Can you tell me how you are able to reproduce with the sample repo? (@samngmco or any other minimal sample code you can share)

Also, which JDK version do you use? Please run the gradle command with --info, the first few lines should reveal the Java executable path used.

I checked out your repo, but since I am using SonarCloud, I have to add the following to build.gradle, but it throws NPE as well

sonarqube {
    properties {
		property "sonar.projectName', 'Example of SonarQube Scanner for Gradle Usage"
		property "sonar.projectKey", "<my_project_name>"
		property "sonar.organization", "<my_organization>"
		property "sonar.host.url", "https://sonarcloud.io"
		property "sonar.login", "xxxx"
    }
}

@janos can you try SonarCloud? I am using Sdkman, Java version 11.02. I compile your code using gradlew, so gradle is your version.

BTW, I am on macOS 10.15.6

And sudo ./gradlew sonarqube will have exactly the same NPE

I’m doing exactly the same thing:

  • Adding equivalent configuration with my details in build.gradle
  • On SonarCloud, of course!
  • Using Java 11.0.3
  • Mac OS X 10.15.5 (update in progress to .6)

As Mark pointed out earlier, the problem is that somehow we’re not able to determine the status of a file (SAME, CHANGED, ADDED), and it’s not easy to see in the code how that’s possible. Every file should have this status, and I’m not able to produce a case where that doesn’t happen, resulting in what you experience.

Can you please send the output of running the gradle command with --debug? I’m hoping to see some other stack trace before this one, that might give a clue.

I modified your org.sonar.scanner.report.ComponentsPublisher and add one debug output

    public void publish(ScannerReportWriter writer) {
        Builder projectBuilder = this.prepareProjectBuilder();
        Builder fileBuilder = Component.newBuilder();
        Iterator var4 = this.inputComponentStore.allFilesToPublish().iterator();

        while(var4.hasNext()) {
            DefaultInputFile file = (DefaultInputFile)var4.next();
            System.out.println(file.absolutePath() + " -> " + file.status());

The output is

/sonarqube-scanner-gradle/src/main/java/com/acme/App.java -> null

debug output contains sensitive info, can I have your email and email you directly?

I changed your scanner code to return FileStatue.SAME, it has a different error, not sure if it is related, but it said 403, but my error is correct.

2020-07-23T01:00:30.872+0800 [QUIET] [system.out] /Users/samng/repos/sonar-scanning-examples/sonarqube-scanner-gradle/src/main/java/com/acme/App.java -> null
2020-07-23T01:00:30.874+0800 [QUIET] [system.out] /Users/samng/repos/sonar-scanning-examples/sonarqube-scanner-gradle/src/test/java/com/acme/AppTest.java -> null
2020-07-23T01:00:30.881+0800 [INFO] [org.sonarqube.gradle.SonarQubeTask] Analysis report generated in 57ms, dir size=154 KB
2020-07-23T01:00:30.908+0800 [INFO] [org.sonarqube.gradle.SonarQubeTask] Analysis report compressed in 26ms, zip size=30 KB
2020-07-23T01:00:30.908+0800 [INFO] [org.sonarqube.gradle.SonarQubeTask] Analysis report generated in /Users/samng/repos/sonar-scanning-examples/sonarqube-scanner-gradle/build/sonar/scanner-report
2020-07-23T01:00:30.908+0800 [DEBUG] [org.sonarqube.gradle.SonarQubeTask] Upload report
2020-07-23T01:00:32.586+0800 [DEBUG] [org.sonarqube.gradle.SonarQubeTask] POST 403 https://sonarcloud.io/api/ce/submit?organization=monacohq&projectKey=monacohq_xfinity-server&projectName=Example%20of%20SonarQube%20Scanner%20for%20Gradle%20Usage | time=1677ms
2020-07-23T01:00:32.591+0800 [DEBUG] [org.gradle.internal.operations.DefaultBuildOperationExecutor] Completing Build operation 'Execute run for :sonarqube'
2020-07-23T01:00:32.591+0800 [DEBUG] [org.gradle.internal.operations.DefaultBuildOperationExecutor] Build operation 'Execute run for :sonarqube' completed
2020-07-23T01:00:32.593+0800 [DEBUG] [org.gradle.internal.operations.DefaultBuildOperationExecutor] Build operation 'Snapshot outputs after executing task ':sonarqube'' started
2020-07-23T01:00:32.594+0800 [DEBUG] [org.gradle.internal.operations.DefaultBuildOperationExecutor] Completing Build operation 'Snapshot outputs after executing task ':sonarqube''
2020-07-23T01:00:32.594+0800 [DEBUG] [org.gradle.internal.operations.DefaultBuildOperationExecutor] Build operation 'Snapshot outputs after executing task ':sonarqube'' completed
2020-07-23T01:00:32.595+0800 [DEBUG] [org.gradle.api.internal.tasks.execution.ResolveTaskExecutionModeExecuter] Removed task artifact state for task ':sonarqube' from context.
2020-07-23T01:00:32.595+0800 [DEBUG] [org.gradle.internal.operations.DefaultBuildOperationExecutor] Completing Build operation 'Task :sonarqube'
2020-07-23T01:00:32.595+0800 [DEBUG] [org.gradle.internal.operations.DefaultBuildOperationExecutor] Build operation 'Task :sonarqube' completed
2020-07-23T01:00:32.596+0800 [INFO] [org.gradle.execution.plan.DefaultPlanExecutor] :sonarqube (Thread[Execution worker for ':' Thread 11,5,main]) completed. Took 19.693 secs.
2020-07-23T01:00:32.596+0800 [DEBUG] [org.gradle.execution.plan.DefaultExecutionPlan] Node :sonarqube failed
2020-07-23T01:00:32.596+0800 [DEBUG] [org.gradle.execution.plan.DefaultExecutionPlan] Node :sonarqube completed, executed: true
2020-07-23T01:00:32.596+0800 [DEBUG] [org.gradle.internal.resources.AbstractTrackedResourceLock] Execution worker for ':' Thread 11: released lock on :
2020-07-23T01:00:32.596+0800 [DEBUG] [org.gradle.internal.work.DefaultWorkerLeaseService] Worker lease root.1.9 completed (1 worker(s) in use)
2020-07-23T01:00:32.597+0800 [DEBUG] [org.gradle.internal.resources.AbstractTrackedResourceLock] Execution worker for ':' Thread 11: released lock on root.1.9
2020-07-23T01:00:32.597+0800 [DEBUG] [org.gradle.execution.plan.DefaultPlanExecutor] Execution worker [Thread[Execution worker for ':' Thread 7,5,main]] finished, busy: 0.0 secs, idle: 19.895 secs
2020-07-23T01:00:32.597+0800 [DEBUG] [org.gradle.execution.plan.DefaultPlanExecutor] Execution worker [Thread[Execution worker for ':' Thread 5,5,main]] finished, busy: 0.0 secs, idle: 19.896 secs
2020-07-23T01:00:32.597+0800 [DEBUG] [org.gradle.execution.plan.DefaultPlanExecutor] Execution worker [Thread[Execution worker for ':' Thread 9,5,main]] finished, busy: 0.0 secs, idle: 19.895 secs
2020-07-23T01:00:32.597+0800 [DEBUG] [org.gradle.execution.plan.DefaultPlanExecutor] Execution worker [Thread[Execution worker for ':' Thread 3,5,main]] finished, busy: 0.0 secs, idle: 19.896 secs
2020-07-23T01:00:32.597+0800 [DEBUG] [org.gradle.execution.plan.DefaultPlanExecutor] Execution worker [Thread[Execution worker for ':' Thread 8,5,main]] finished, busy: 0.0 secs, idle: 19.895 secs
2020-07-23T01:00:32.597+0800 [DEBUG] [org.gradle.execution.plan.DefaultPlanExecutor] Execution worker [Thread[Execution worker for ':' Thread 6,5,main]] finished, busy: 0.0 secs, idle: 19.896 secs
2020-07-23T01:00:32.597+0800 [DEBUG] [org.gradle.execution.plan.DefaultPlanExecutor] Execution worker [Thread[Execution worker for ':' Thread 10,5,main]] finished, busy: 0.0 secs, idle: 19.895 secs
2020-07-23T01:00:32.597+0800 [DEBUG] [org.gradle.execution.plan.DefaultPlanExecutor] Execution worker [Thread[Execution worker for ':' Thread 4,5,main]] finished, busy: 0.0 secs, idle: 19.896 secs
2020-07-23T01:00:32.597+0800 [DEBUG] [org.gradle.execution.plan.DefaultPlanExecutor] Execution worker [Thread[Execution worker for ':' Thread 11,5,main]] finished, busy: 19.757 secs, idle: 0.138 secs
2020-07-23T01:00:32.597+0800 [DEBUG] [org.gradle.execution.plan.DefaultPlanExecutor] Execution worker [Thread[Execution worker for ':',5,main]] finished, busy: 0.0 secs, idle: 19.896 secs
2020-07-23T01:00:32.597+0800 [DEBUG] [org.gradle.execution.plan.DefaultPlanExecutor] Execution worker [Thread[Daemon worker,5,main]] finished, busy: 0.0 secs, idle: 19.895 secs
2020-07-23T01:00:32.597+0800 [DEBUG] [org.gradle.execution.plan.DefaultPlanExecutor] Execution worker [Thread[Execution worker for ':' Thread 12,5,main]] finished, busy: 0.11 secs, idle: 19.785 secs
2020-07-23T01:00:32.597+0800 [DEBUG] [org.gradle.execution.plan.DefaultPlanExecutor] Execution worker [Thread[Execution worker for ':' Thread 15,5,main]] finished, busy: 0.0 secs, idle: 19.895 secs
2020-07-23T01:00:32.597+0800 [DEBUG] [org.gradle.execution.plan.DefaultPlanExecutor] Execution worker [Thread[Execution worker for ':' Thread 2,5,main]] finished, busy: 0.0 secs, idle: 19.896 secs
2020-07-23T01:00:32.597+0800 [DEBUG] [org.gradle.execution.plan.DefaultPlanExecutor] Execution worker [Thread[Execution worker for ':' Thread 13,5,main]] finished, busy: 0.0 secs, idle: 19.895 secs
2020-07-23T01:00:32.597+0800 [DEBUG] [org.gradle.execution.plan.DefaultPlanExecutor] Execution worker [Thread[Execution worker for ':' Thread 14,5,main]] finished, busy: 0.0 secs, idle: 19.895 secs
2020-07-23T01:00:32.601+0800 [DEBUG] [org.gradle.execution.taskgraph.DefaultTaskExecutionGraph] Timing: Executing the DAG took 19.901 secs
2020-07-23T01:00:32.603+0800 [DEBUG] [org.gradle.internal.operations.DefaultBuildOperationExecutor] Completing Build operation 'Run tasks'
2020-07-23T01:00:32.603+0800 [DEBUG] [org.gradle.internal.operations.DefaultBuildOperationExecutor] Build operation 'Run tasks' completed
2020-07-23T01:00:32.606+0800 [DEBUG] [org.gradle.internal.work.DefaultWorkerLeaseService] Worker lease root.1 completed (0 worker(s) in use)
2020-07-23T01:00:32.606+0800 [DEBUG] [org.gradle.internal.resources.AbstractTrackedResourceLock] Daemon worker: released lock on root.1
2020-07-23T01:00:32.610+0800 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] 
2020-07-23T01:00:32.610+0800 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] FAILURE: Build failed with an exception.
2020-07-23T01:00:32.610+0800 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] 
2020-07-23T01:00:32.610+0800 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] * What went wrong:
2020-07-23T01:00:32.610+0800 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] Execution failed for task ':sonarqube'.
2020-07-23T01:00:32.611+0800 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] > You're not authorized to run analysis. Please contact the project administrator.
2020-07-23T01:00:32.611+0800 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] 
2020-07-23T01:00:32.611+0800 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] * Try:
2020-07-23T01:00:32.611+0800 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]  Run with --scan to get full insights.
2020-07-23T01:00:32.611+0800 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] 
2020-07-23T01:00:32.611+0800 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] * Exception is:
2020-07-23T01:00:32.612+0800 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] org.gradle.api.tasks.TaskExecutionException: Execution failed for task ':sonarqube'.
2020-07-23T01:00:32.612+0800 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] 	at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.lambda$executeIfValid$1(ExecuteActionsTaskExecuter.java:207)
2020-07-23T01:00:32.612+0800 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] 	at org.gradle.internal.Try$Failure.ifSuccessfulOrElse(Try.java:263)
2020-07-23T01:00:32.612+0800 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] 	at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeIfValid(ExecuteActionsTaskExecuter.java:205)
2020-07-23T01:00:32.612+0800 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] 	at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.execute(ExecuteActionsTaskExecuter.java:186)
2020-07-23T01:00:32.612+0800 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] 	at org.gradle.api.internal.tasks.execution.CleanupStaleOutputsExecuter.execute(CleanupStaleOutputsExecuter.java:114)
2020-07-23T01:00:32.612+0800 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] 	at org.gradle.api.internal.tasks.execution.FinalizePropertiesTaskExecuter.execute(FinalizePropertiesTaskExecuter.java:46)
2020-07-23T01:00:32.612+0800 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] 	at org.gradle.api.internal.tasks.execution.ResolveTaskExecutionModeExecuter.execute(ResolveTaskExecutionModeExecuter.java:62)
2020-07-23T01:00:32.612+0800 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] 	at org.gradle.api.internal.tasks.execution.SkipTaskWithNoActionsExecuter.execute(SkipTaskWithNoActionsExecuter.java:57)
2020-07-23T01:00:32.612+0800 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] 	at org.gradle.api.internal.tasks.execution.SkipOnlyIfTaskExecuter.execute(SkipOnlyIfTaskExecuter.java:56)
2020-07-23T01:00:32.613+0800 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] 	at org.gradle.api.internal.tasks.execution.CatchExceptionTaskExecuter.execute(CatchExceptionTaskExecuter.java:36)
2020-07-23T01:00:32.613+0800 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] 	at org.gradle.api.internal.tasks.execution.EventFiringTaskExecuter$1.executeTask(EventFiringTaskExecuter.java:77)
2020-07-23T01:00:32.613+0800 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] 	at org.gradle.api.internal.tasks.execution.EventFiringTaskExecuter$1.call(EventFiringTaskExecuter.java:55)
2020-07-23T01:00:32.613+0800 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] 	at org.gradle.api.internal.tasks.execution.EventFiringTaskExecuter$1.call(EventFiringTaskExecuter.java:52)
2020-07-23T01:00:32.613+0800 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] 	at org.gradle.internal.operations.DefaultBuildOperationExecutor$CallableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:416)
2020-07-23T01:00:32.613+0800 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] 	at org.gradle.internal.operations.DefaultBuildOperationExecutor$CallableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:406)
2020-07-23T01:00:32.613+0800 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] 	at org.gradle.internal.operations.DefaultBuildOperationExecutor$1.execute(DefaultBuildOperationExecutor.java:165)
2020-07-23T01:00:32.613+0800 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] 	at org.gradle.internal.operations.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:250)
2020-07-23T01:00:32.613+0800 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] 	at org.gradle.internal.operations.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:158)
2020-07-23T01:00:32.613+0800 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] 	at org.gradle.internal.operations.DefaultBuildOperationExecutor.call(DefaultBuildOperationExecutor.java:102)
2020-07-23T01:00:32.613+0800 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] 	at org.gradle.internal.operations.DelegatingBuildOperationExecutor.call(DelegatingBuildOperationExecutor.java:36)
2020-07-23T01:00:32.613+0800 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] 	at org.gradle.api.internal.tasks.execution.EventFiringTaskExecuter.execute(EventFiringTaskExecuter.java:52)
2020-07-23T01:00:32.613+0800 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] 	at org.gradle.execution.plan.LocalTaskNodeExecutor.execute(LocalTaskNodeExecutor.java:41)
2020-07-23T01:00:32.614+0800 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] 	at org.gradle.execution.taskgraph.DefaultTaskExecutionGraph$InvokeNodeExecutorsAction.execute(DefaultTaskExecutionGraph.java:370)
2020-07-23T01:00:32.614+0800 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] 	at org.gradle.execution.taskgraph.DefaultTaskExecutionGraph$InvokeNodeExecutorsAction.execute(DefaultTaskExecutionGraph.java:357)
2020-07-23T01:00:32.614+0800 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] 	at org.gradle.execution.taskgraph.DefaultTaskExecutionGraph$BuildOperationAwareExecutionAction.execute(DefaultTaskExecutionGraph.java:350)
2020-07-23T01:00:32.614+0800 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] 	at org.gradle.execution.taskgraph.DefaultTaskExecutionGraph$BuildOperationAwareExecutionAction.execute(DefaultTaskExecutionGraph.java:336)
2020-07-23T01:00:32.614+0800 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] 	at org.gradle.execution.plan.DefaultPlanExecutor$ExecutorWorker.lambda$run$0(DefaultPlanExecutor.java:127)
2020-07-23T01:00:32.614+0800 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] 	at org.gradle.execution.plan.DefaultPlanExecutor$ExecutorWorker.execute(DefaultPlanExecutor.java:191)
2020-07-23T01:00:32.614+0800 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] 	at org.gradle.execution.plan.DefaultPlanExecutor$ExecutorWorker.executeNextNode(DefaultPlanExecutor.java:182)
2020-07-23T01:00:32.614+0800 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] 	at org.gradle.execution.plan.DefaultPlanExecutor$ExecutorWorker.run(DefaultPlanExecutor.java:124)
2020-07-23T01:00:32.614+0800 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] 	at org.gradle.internal.concurrent.ExecutorPolicy$CatchAndRecordFailures.onExecute(ExecutorPolicy.java:64)
2020-07-23T01:00:32.614+0800 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] 	at org.gradle.internal.concurrent.ManagedExecutorImpl$1.run(ManagedExecutorImpl.java:48)
2020-07-23T01:00:32.614+0800 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] 	at org.gradle.internal.concurrent.ThreadFactoryImpl$ManagedThreadRunnable.run(ThreadFactoryImpl.java:56)
2020-07-23T01:00:32.614+0800 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] Caused by: You're not authorized to run analysis. Please contact the project administrator.
2020-07-23T01:00:32.614+0800 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] 
2020-07-23T01:00:32.614+0800 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] 
2020-07-23T01:00:32.615+0800 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] * Get more help at https://help.gradle.org

FYI, I am the repo maintainer, but not the Github organization admin

The reason is permission. I have our admin gave me admin access in SonarCloud. Then it works.

I think the most important one maybe “create project” permission.

I’m glad you were able to trace it back to a permission issue, nicely done! I will try to reproduce to understand how that can lead to the NPE, and improve it to produce a helpful error message.