Hi, We have setup SonarCloud analysis from our azure devops yaml pipeline (using ubuntu MS hosted agent) using built-in tasks like Prepare, Analyze and Publish (Also tried with ant sonarcheck command still same error). While running manually from branch, the execution is successful & we’re able to see the data on the sonarcloud portal.
But when we raise a PR and the Automated PR run is triggered on the pipeline, it fails with below errors:
bin/platform/build.xml:72: The following error occurred while executing this line:
bin/platform/resources/ant/sonar.xml:95: java.lang.IllegalStateException: Unable to load component class org.sonar.scanner.scan.filesystem.InputComponentStore
Caused by: java.lang.IllegalStateException: Unable to load component interface org.sonar.scanner.scan.branch.BranchConfiguration
While the manually triggered branch run is working fine,issue occurs only with the PR automated runs.
We have already setup PR from the admin settings of the project on the sonar cloud portal. We’re also using valid service connection setup on the Azure DevOps for Sonar Cloud.
Have you checked to see if the token set at the Organization level is still valid? (global Administration > Organization settings)
You can also check if you have something configured at the project-level: (Project-level Administration > Pull Requests > Integration with Azure DevOps Services > Personal access token).
Typically when main branch analysis works but PR analysis fails, this is the culprit.
Yes I have tested the token which I used to configure on Azure DevOps service connection. It is working fine with connection established.
Even the valid PAT token I have added under Pull Requests of Project admin settings.
The project was created very long ago on the Sonar Cloud portal which we are trying to use now, could it be because of that ?
Does the Sonar Token need to have been created by an Admin or anyone with write access can create one ?
To be clear, this should be an Azure DevOps PAT, not a SonarCloud PAT. Have you added a PAT that you generated in Azure DevOps? This won’t be the same one as you’ve added in the Azure DevOps service connection (which should be a SonarCloud PAT).
Okay! And that worked without setting any PAT at the project-level? In that case, try removing the PAT you have set at the project-level in the failing project.