Project Move

Project Move allows you to export a project from one SonarQube instance and import it into another SonarQube instance. To use Project Move, you must have the Administer permission on the project in the source instance, and access to the file systems of both instances.

When to use Project Move

Project Move can help you with the following situations:

  • You want to create a central SonarQube instance at the enterprise level and you want to keep the history created on instances used previously at the team level.
  • You want to consolidate your editions and move projects from a Community Edition instance to an Enterprise Edition instance or above.
  • Your company is acquiring another company that already has a central SonarQube instance.
  • You are at a large company with several SonarQube instances and an application is transferred from one team to another.

Prerequisites

To export your project's data from the source instance and then load it on the target instance, make sure the following are true.

The target instance must:

The target instance can have additional plugins and languages that aren't in the source instance, but not the other way around. If your source instance has plugins that aren't in your target instance, either remove them and reanalyze your project or add them to your target instance.

Both source and target instances must have:

  • The exact same SonarQube version
  • The same custom metrics
  • The same custom rules

How to export

Your source instance can be Community Edition or above, but cannot have plugins or languages that are not in the target instance.

On the source instance:

  1. Review the branches of the project by navigating to Project Settings > Branches & Pull Requests and enable the Keep when inactive button for each branch you want to keep. Note that Pull Requests are not saved when exporting a project.
  2. Reanalyze the project one last time for each branch that has enabled Keep when inactive option to make sure it is populated with data corresponding to your current SonarQube installation.
  3. Navigate to the project and at the project level, choose Project Settings > Import / Export.
  4. Click on the Export button to generate a zip file containing the settings and history of your Project (but not the source code). Note that if you need to change the Project's key, you must do it before performing the export.

A zip file containing all project data is generated in $SONAR_SOURCE_HOME/data/governance/project_dumps/export named <project_key>.zip.

How to import

Your target instance must be Enterprise Edition or above.

On the target instance:

  1. With a user having the "Administer System" and "Create Projects" permissions, go to Administration > Projects > Management and provision the project using the same key the project had in the source instance.
  2. Configure the Project's permissions and the Quality Profiles and Quality Gate associated with the Project.
  3. Put the generated zip file into the directory $SONAR_TARGET_HOME/data/governance/project_dumps/import. You need to create the governance/project_dumps/import folders the first time.
  4. Go to the Project's Home Page and choose Project Settings > Import / Export.
  5. Click on the Import button to start importing your data.
  6. Source code is not included in the zip file. Once the import is finished, trigger an analysis to import source files into the new instance.

Notes:

  • If the import is successful, the zip file will automatically be deleted.
  • It is not possible to import a project that has been already analyzed on the target instance.
  • Security reports in an imported project will be empty until an analysis has run.