How to replace sonar.branch.target property to point on the branch about which the sonar should run in runtime

Hi everyone,

I’m currently using SonarQube Version 8.9.6 (build 50800) and in this version property which helped us to configure target branch about which sonar should run on current branch in runtime (sonar.branch.target) is no longer supported. Could you advice me how could I configure it in runtime during Jenkins build, so some PRs will run relative to develop branch and others relative to release/… branch and so on?

Hey there.

sonar.branch.target is not (and was never) necessary for Pull Request analysis, as in this case sonar.pullrequest.* analysis parameters should kick in (and sonar.pullrequest.base defines the branch the PR will be merged into). In SonarQube v8.9.6 with Jenkins, this should all be automatically configured.

For Branch analysis it’s true that sonar.branch.target no longer exists, and you will have to configure a Reference branch New Code Definition in the UI for a proper comparison to be made. For what it’s worth, we brought the spiritual successor to sonar.branch.target in the form of sonar.newCode.referenceBranch in SonarQube v9.4 (just released this week).

1 Like

Thanks a lot Colin, for your answer, I believe that is what I was looking to

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.