Configure SonarScanner for Gradle: Configure new code definition from code

Is there a way to set the new code definition for a branch from the sonar gradle plugin?

Looking at the documentation, I can’t find any properties that would enable this. Can I get some insight on whether it was supported in the past, in feature development, etc.

Hey there.

There’s some missing information in your post from the topic template:

Must-share information (formatted with Markdown):

  • which versions are you using (SonarQube, Scanner, Plugin, and any relevant extension)

Hey Colin,

We are using the SonarQube Developer Edition on version

For the SonarQube gradle plugin, we are on 3.2.0.


In this case, the New Code Period can’t be set via configuration file.

In v9.x, if you use the Reference Branch New Code Period, it is possible to set sonar.newCode.referenceBranch from the analysis properties.

1 Like

Thanks Colin!

Would I still need to go into SonarQube and manually configure the project settings if I want to update new code definition for all branches in the project (but keep the reference branch’s new code def as previous commit).