With the following change, Sonar introduced options to set the “New Code Period” on project and branch level.
However, there is no way to set this with properties when using the gradle plugin when introducing a new (feature)-branch.
Something similar was previously possible with the now deprecated “sonar.branch.target” property.
In our projects, it’s not possible to set the reference-branch on project level because different branches do need different reference branches. It is also not practical to expect from our devs to set for every single short-lived-branch the according reference branch manually in the sonar-ui.
Instead, our CI pipeline should be able to do this by using the sonar gradle plugin when scanning the branch for the first time. This is currently not possible, though.
I understand that there might be a way to set the relevant options with the Sonar REST API at /web_api/api/new_code_periods
This is, however, just introducing additional complexity to the CI pipelines which should be handled by the sonar gradle plugin itself.