After upgrade from 7.7 to 8.8: sonar.branch.name and sonar.branch.target

I have upgraded SonarQube Developer Edition from 7.7 to 8.8 (7.7 → 7.9 LTS → 8.8).

This is my Maven command to start a SonarQube analysis:

mvn --no-transfer-progress \
    --global-settings /home/ubuntu/jenkins/workspace/foobar@tmp/config12345tmp \
    -Dmaven.repo.local=/home/ubuntu/jenkins/workspace/foobar/.repository \
    org.sonarsource.scanner.maven:sonar-maven-plugin:3.7.0.1746:sonar \
    -Dsonar.branch.name=7.2/null_test \
    -Dsonar.branch.target=7.2.0_preparations

I now get this message during analysis:

[WARNING] Parameter ‘sonar.branch.target’ is no longer supported

I will remove -Dsonar.branch.target=... from the mvn sonar:sonar command.

I also get:

[INFO] Found manual configuration of branch/PR analysis. Skipping automatic configuration.

Does this mean that I no longer need -Dsonar.branch.name=... or can I still use it?

Hey there.

Indeed, sonar.branch.target is now useless.

It depends – are you running your analysis as part of a CI build? If so, with what CI tool (Jenkins, Gitlab CI, etc.)

We use Jenkins.

  1. Happy Cake Day :slight_smile:
  2. Great! If you’re using a Branch Source plugin (like the GitHub Branch Source or Bitbucket Branch Source plugin to trigger your Jenkins builds, auto-configuration should work. For branch analysis, the specific plugin isn’t as important as the environment variables they provide (namely BRANCH_NAME)

We use Bitbucket Branch for some, but not all, of our builds.

Not 100% sure, but I think we use the environment variable BRANCH_NAME as a value for sonar.branch.name.

In which case you should be good to go. Give it a try by removing your manual branch configuration.

Thanks, but if it’s not broken, then I’d rather not fix it.

I’m leaving that gig soon, and I don’t want the next person to be confused. Like I wrote, we use Bitbucket Branch for some, but not all builds. For those that don’t, I assume that the manual branch config is still needed?

It depends on whether or not the BRANCH_NAME environment variable exists when you’re building a branch.

1 Like