How to add branches other than main branch to be analyzed?

  • ALM used : GitHub
  • CI system used : Circle CI
  • Languages of the repository : Java, Kotlin
  • Error observed : No errors.
  • Steps to reproduce : Create new branches in GitHub, commit code, those branches are not visible in SonarCloud.
  • Potential workaround : None identified

Hey there.

If you’re using Automatic Analysis, only the main branch and pull request will be analyzed. You would need to switch to CI-based analysis to analyze other branches.

Thank you, Colin for the solution. I will try it and update here.

Hello Team,

I have switched to CI-based analysis, and when the CircleCI build runs, it throws an error displaying the below content:

#!/bin/bash -eo pipefail gradle build sonarqube
/bin/bash: gradle: command not found
Exited with code exit status 127
CircleCI received exit code 127

I have already added the plugins and properties in build.gradle for my Android project.

plugins {
id “org.sonarqube” version “”

sonarqube {
properties {
property “sonar.projectKey”, “<key_name_from_sonarCloud>”
property “sonar.organization”, “<org_name>”
property “”, “
property “sonar.sourceEncoding”, “UTF-8”
property “sonar.projectKey”, “<project_key>”
property “sonar.projectName”, “<project_name>”
property “sonar.sources”,“src/main/java”
property “sonar.login”,“”

in config.yml file,

  • run:
    name: Analyze on SonarCloud
    command: gradle build sonarqube

Please let me know, what I might have done wrong.

It seems like Gradle isn’t installed on the machine you’re executing analysis, or can’t be found on the PATH. I would make sure that a gradle build works by itself, and then add in sonarqube.

Thanks, @Colin , I found the solution, gradle build was missing in my config.yml file.
After adding the below line, it resolved the above issue.

  • run:
    name: Analyze on SonarCloud
    command: ./gradlew sonarqube -Dsonar.login=<SONAR_TOKEN>