Sonarscan failing for PR builds using gradle on sonarqube 9.5

Post upgrade from sonarqube 9.3 to 9.5 , we are facing issue for one of our project in which Pull request scans are getting failed.

  • When we performed the same scan on 9.3 it passes.
  • We are using sonarqube enterprise edition 9.5
  • Gradle sonarqube plugin veresion 2.8(we have tried other version until 3.4)
  • We are using gradle sonarscan and gradle version is 7.4
  • Below is the error message while running Pull Request scan.
What went wrong:
Execution failed for task ':sonarqube'.
> java.lang.UnsupportedOperationException (no error message)

We tried adding --debug for better log, but is also showing the same error message as above.
No other error message any info.

This is strange, because for all other projects which are using the same code logic are working.
Also within the same repo, all branch builds scans are successful.

Below is the command which we are using to run the scans for PR scans

            sh"gradle sonarqube \
                -Dsonar.login=$SONAR_TOKEN \
                -Dsonar.projectName=JOB_NAME \
                -Dsonar.projectKey=JOB_NAME \
                -Dsonar.projectVersion=JOB_VERSION \
                -Dsonar.sources=src/main \
                -Dsonar.sourceEncoding=UTF-8 \
                -Dsonar.pullrequest.key=xx \
                -Dsonar.pullrequest.base=master \
                -Dsonar.pullrequest.branch=BRANC_NAME"

Please let us know if anyone has faced this issue.

Hey there.

You’re facing SONARJAVA-4267, which was fixed in SonarQube v9.6.

Thanks Colin for the quicker response.
Will test the mitigation.

The mitigation worked for us.
Thanks again for quicker response.