Adding tags to a project via analysis properties?

Like some have mentioned in this thread, organisations typically have repositories/projects in hundreds/thousands of numbers.

If they initiate a task of onboarding all these projects to Sonarqube, there is always a manual effort involved to go to the Sonarqube dashboard and update labels for all these projects.

Even for new repositories that rely on a boilerplate/template based project and config generation, there will be common config used for sonarqube where the only variables will be the sonar.projectKey and sonar.sources. In such situations, we will expect the first build of that project to automatically create a project on sonarqube when sonar-scanner runs and setup bare minimum things for that project which also includes tags.

Sure there’s an API but that is still an additional step to do in the form of scripting which can easily be done as part of sonar scanner. If a project is not created manually on Sonarqube, the sonar-scanner automatically creates one the first time it runs analysis inside a repository. That is the perfect place to also update the tags on the project.

Tag is metadata just like project key that we pass from Why not let us update tags via file itself?

Is it at project creation that you need that or even for the subsequent analyses?

It’s at project creation that we want to update the tags. Using the api call means we will have to have an additional script in the CI config of the repository that calls the sonar-scanner.

Hi all,

There have been a lot of participants in this thread, so I’d like to ask for some thoughts on how this would work.

First though, I want to address project key. A couple people have cited it as analogous to tags. But project key isn’t metadata; it’s a unique identifier. When you set sonar.projectKey for an analysis, it’s to identify which project you’re updating.

Project name might be a better example. It’s optional, and if you change the value you pass, then the name is updated in SonarQube.

So now to seque to my question: with the exception of sonar.projectName, analysis parameters are specific to the analysis, and don’t update the underlying project.

With that in mind, how would you expect a theoretical sonar.projectTags to work? Like project name: pass a comma-delimited list and it “sticks” until you pass a new list? Or require that it be passed with every analysis, otherwise the tags “fall off”?


Yes pretty much like that - sticks unless we pass an updated list of the comma separated values.

For example:


So when a new project gets created due to the first time sonar scan, these tags will automatically get created. This is useful especially when organisations have automated scripts like template generators as part of developer experience which setup projects and initialise things like CI, static code analysis etc.


+100 for this one, it would make our lives much simpler to have something like sonar.projectTags, this usually is set only once in our case. And similar to @Abhijeet_Vaikar mentions we use a SonarQube template generator to add the projects to the sonar instance from our Gitlab CI.

1 Like

I have logged this feature request in 2019 via - Tag projects through sonar-scanner - [Deprecated] Suggest new features / New features - Sonar Community (

1 Like