GitHub Action for SonarCloud throws exception

Hello community,

I am using Java and Gradle and pushed my project to GitHub. I chose the sonarcloud workflow as an action, the free one for public repositories. I enabled verbose mode in the yaml-file because I got an error thrown, when I started analysis. Here is the full output:

INFO: Scanner configuration file: /opt/sonar-scanner/conf/sonar-scanner.properties


java.lang.IllegalStateException: Unable to load component class org.sonar.scanner.bootstrap.GlobalConfiguration

(https://github.com/XXX/YYY/actions/runs/5877342166/job/15937289033#step:3:48) at org.sonar.core.platform.ComponentContainer$ExtendedDefaultPicoContainer.getComponent(ComponentContainer.java:52)(https://github.com/XXX/YYY/actions/runs/5877342166/job/15937289033#step:3:49) at org.picocontainer.DefaultPicoContainer.getComponent(DefaultPicoContainer.java:632)


Caused by: Project not found. Please check the ‘sonar.projectKey’ and ‘sonar.organization’ properties, the ‘SONAR_TOKEN’ environment variable, or contact the project administrator

But I have defined all variables in the sonar-project.properties, in the buidl.gradle and also in the Yaml-File just in case I missed a place where the action could search for the properties. Also my user has execution right in SonarCloud.

Does anyone know what the issue is?

Hi,

Welcome to the community!

You’ve already verified your project and organization values, so the problem is the third thing: the analysis token. Double-check how you’re setting the SONAR_TOKEN value in the environment.

 
HTH,
Ann