sonar.projectVersion static or dynamic value

Must-share information (formatted with Markdown):

My questions:

  1. is sonar.projectVersion static or dynamic value
  2. My Sonar project has multiple branches support in one Git Repo
  • develop - 1.0
  • rel_1.5 - 1.5
  • rel_2.0 - 2.0
    Since there are multiple versions, what should be the value for sonar.projectVersion?


Sorry, I don’t understand the distinction you’re making here.

sonar.projectVersion is a string. For each analysis you should pass in the version string for what you’re currently working on. For instance, we’re currently working on the SonarQube 10.3 release, so that’s what we pass in for version. But if we have to patch the SonarQube 9.9 branch, then the version string is 9.9.3 (because that will be the next patch version of the LTS.)


In document, “Do not use your build number as sonar.projectVersion .”
What is sonar.projectVersion use for?
I have branch analysis setup. Analysis for same branch should have same projectVersion value?
i.e. develop = 1.0, rel_1.5 = 1.5


That’s a great question!

The intent is to mark the analysis of a release. That way, the event we set on the analysis record preserves the record of the quality at the time of the release. And along those lines, if you use Previous Version for your New Code definition, then each time the value changes, it resets what’s considered new.

For branches, the assumption is the same. So if you have a branch for a previous release, as I talked about earlier, you would change the sonar.projectVersion value for each new point release of that branch.