Need to rename old projects as "archived" in SonarQube server

Hi, I am using SonarQube 8.8 Enterprise version.

We are in a situation where we recently upgraded from Community to Enterprise. Has been a great upgrade so far! Though there are some projects that are no longer in use that are interspersed with the active projects.

Since we want to keep this old project data for future reference, is there a way that I could re-label the old projects to something along the lines of archived-<project-name> directly using the SonarQube server GUI?

(Note: Since the old projects are no longer actively run, we are not able to update the project name by rerunning the analysis scans with a new project name set.)

Is this feature possible with SonarQube?

Thanks in advance!


changing the is simply done by changing the sonar.projectName
in the next analysis for an existing Sonarqube project, which is no option in your case.

Right now there is no web api call for renaming projects, only for project key api/projects/update_key .
Did a rename in Sonarqube DB - normally you should treat the DB as black box - when i needed to rename a bunch of project names.

Here’s an example using Groovy (needs mssql jdbc driver and dll for integrated authentication)
with a MSSQL database

import groovy.sql.Sql
import groovy.sql.DataSet

// DB
def dbserver = $/XYZ1234\MSSQL64/$
def dbname='XXX_SonarQube_XX'
def list = []
def sql1 = Sql.newInstance("jdbc:sqlserver://$dbserver;databaseName=$dbname;integratedSecurity=true",
  "", "", "")
def sql2 = Sql.newInstance("jdbc:sqlserver://$dbserver;databaseName=$dbname;integratedSecurity=true",
  "", "", "")  

sql1.eachRow("select * from dbo.projects where name LIKE '%.FOO -%'") { row ->
// println "$"
  s = "Update dbo.projects SET name=${ - '.FOO'} where name=$"
// println s

Don’t know your criteria to identify the project names to be changed, but the other part is
something like

s = "Update dbo.projects SET name=${'archived - ' +} where name=$"


Hello @Alexandra,

I am not sure that project renaming is the right solution for your problem.
As @Rebse mentioned:

  • The standard way to rename projects is by re-analyzing them and you probably don’t want to do that
  • The risky way (unsupported, use at your own risks), it to directly edit the database. I strongly discourage this

I can suggest something different: You could use project tags to mark projects that are archived (and potentially also add tags for projects that are active).
This can easily be done manually (requires project administration permission on the tagged project) or programmatically (using api/project_tags/set).
Tagging projects that are active can be useful because on the SonarQube main projects page, you can only filter by projects that do have a given tag (eg active) not by projects that do not have have a tag (filtering (showing) projects that are not archived is not possible).



1 Like