Sonar Scan task for Gradle failing

Hi All,

I am trying to integrate my Gradle based Java Project to be scanned by Sonarqube ran through a jenkins pipeline.
Issue - The build fails with the below error while running the Sonarqube task in build.gradle( root directory)

[INFO] [org.gradle.api.internal.tasks.execution.SkipUpToDateTaskExecuter] Executing task ':sonarqube' (up-to-date check took 0.0 secs) due to:
2021-03-01 15:58:17:616 GMT+05:30    Task has not declared any outputs.
[DEBUG] [org.sonarqube.gradle.SonarQubeTask] Could not complete symbolic execution: 
2021-03-01 15:58:28:087 GMT+05:30$MaximumStepsReachedException: reached limit of 16000 steps for method validateLinkedTradeIdIsPopulated#823 in class CustomTradeValidator
[ERROR] [org.gradle.BuildExceptionReporter] 
[org.gradle.BuildExceptionReporter] FAILURE: Build failed with an exception.
[org.gradle.BuildExceptionReporter] * What went wrong:
[ERROR] [org.gradle.BuildExceptionReporter] Execution failed for task ':sonarqube'.
[ERROR] [org.gradle.BuildExceptionReporter] > java.lang.NullPointerException (no error message)
[ERROR] [org.gradle.BuildExceptionReporter] 
[ERROR] [org.gradle.BuildExceptionReporter] * Exception is:
[ERROR] [org.gradle.BuildExceptionReporter] org.gradle.api.tasks.TaskExecutionException: Execution failed for task ':sonarqube'.
 Execution failed for task ':sonarqube'.
[ERROR] [org.gradle.BuildExceptionReporter] > java.lang.NullPointerException (no error message)

[ERROR] [org.gradle.BuildExceptionReporter] Caused by: java.lang.NullPointerException

Gradle version : 6.8.2
Sonarqube Version : 7.9.1
Sonarqube Plugin version : 3.1
Java - jdk1.8.0_191

Kindly suggest how to fix this

Rahul Singh

Hi @Rahuls,

Welcome to SonarSource Community! :sonarsource:

  1. This may be permissions related. Can you check that the user/login token for this build is allowed to run the sonar scanner (“create projects” permission)?
  2. Is this the first time you are scanning this project?
  3. Can you try scanning this project on your local machine instead of Jenkins and see if that works first? This will segregate the issue from Jenkins from local scan.
  4. Also, what version of SonarJava plugin do you have? Make sure you have v6.3.2 installed on your SonarQube from the Marketplace.


Hi Joe,

Thanks for your response.

  1. The project is now created, not sure what the issue was ,
    However I included (property “sonar.scm.disabled” , ‘true’) in the root build.gradle.
  2. Yes the project was scanned for the first time by sonar plugin in gradle.
  3. I suppose the local setup and execution might not be required as the task seems to work fine.
  4. I am not sure about he SonarJava plugin , if this is the same sonar plugin for gradle , the version is 3.1.1


Hi @Rahuls ,

Glad you got it working. I suggest leaving “sonar.scm.disabled” as false since this is helpful for determining blame information in the code and tracking it for you, but that’s optional.

Sorry I meant that the SonarJava plugin on the SonarQube side, not the Scanner side. You are using Sonar scanner for Gradle 3.1.1, which is correctly the latest one so that’s good.

Hope your scanning adventures are successful!


This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.