Hi Team,
I have mentioned the branch name in the sonar.properties file, which matches the permanent branch patterns, using cli it’s unable to create a project in soanrcloud and failed to execute soanrscan analysis. If I create a project manually and run the sonar analysis using pipeline it’s working fine but automatically it is fail to create a project and perform the code scan. Can you please provide a solution to fix this issue?
error:
09:41:01.513 DEBUG: Could not process project pull requests - continuing without it
09:41:01.514 INFO: Load project pull requests (done) | time=186ms
09:41:01.519 INFO: Load branch configuration
09:41:01.520 DEBUG: Found manual configuration of branch/PR analysis. Skipping automatic configuration.
09:41:01.530 INFO: ------------------------------------------------------------------------
09:41:01.530 INFO: EXECUTION FAILURE
09:41:01.531 INFO: ------------------------------------------------------------------------
09:41:01.531 INFO: Total time: 13.692s
09:41:01.592 INFO: Final Memory: 20M/67M
09:41:01.592 INFO: ------------------------------------------------------------------------
09:41:01.592 ERROR: Error during SonarScanner execution
java.lang.IllegalStateException: Unable to load component class org.sonar.scanner.scan.filesystem.InputComponentStore
at org.sonar.core.platform.ComponentContainer$ExtendedDefaultPicoContainer.getComponent(ComponentContainer.java:52)
at org.picocontainer.DefaultPicoContainer.getComponent(DefaultPicoContainer.java:632)
at org.picocontainer.parameters.BasicComponentParameter$1.resolveInstance
Thanks,
Sowmya
Hi @Sowmya_Pandanaboina,
Thanks for sending the stack-trace!
If I create a project manually and run the sonar analysis using pipeline it’s working fine but automatically it is fail to create a project and perform the code scan
Can you elaborate on what you mean when you say you created a project manually or automatically?
Also which CI are you running your pipelines on?
Hi Tom & Team,
I’m running the sonar-scan analysis in cloudbees pipeline.
expected results:
When we run this sonar-scanner cmd in the pipeline, it should automatically create a project in sonarcloud and perform the code analysis.
sonar-scanner -X -Dsonar.login=${pass} -Dsonar.projectName=${projectName} -Dproject.settings= sonar-project.properties -Dsonar.projectKey=${projectName} -Dsonar.projectVersion=${version} -Dsonar.organization= -Dsonar.branchName=${branchName}
error:
if we mention the branch name which matches the permanent branch pattern. Pipeline fails to create a project in sonarcloud and execution is failed.
If I create the project manually in sonarcloud console and run the pipeline. its working fine and sonar-scan execution successfully. but we want it automatically.
Could you please help me to fix this issue?
Thanks,
Sowmya.P
Hi @Sowmya_Pandanaboina,
Apologies for the late reply, I lost sight of this thread.
What you experience is because when a branch analysis is configured (sonar.branch.name
is set) we want to make sure that there is a default branch configured to which we can compare the configured branch.
In your case your project does not exist yet, so we also can not resolve the default branch of your project.
A resolution on your side would be to not set the -Dsonar.branchName=${branchName}
property when running the scanner on the main branch for the first time. This will automatically create a project in SonarCloud with the default branch correctly set-up.