Project move
Project Move allows you to export a project from one SonarQube Server instance and import it into another SonarQube Server instance.
To use Project Move, you must have Administer permission rights on the project in the source instance and access to the file systems of both instances.
When you move a project from a source to a target instance, all project data are moved except:
Source code
Issue assignments
Security reports
When to use project move
Project Move can help you with the following situations:
You want to create a central SonarQube Server 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 SonarQube Community Build instance to an Enterprise Edition instance or above.
Your company is acquiring another company that already has a central SonarQube Server instance.
You are at a large company with several SonarQube Server instances and an application is transferred from one team to another.
Prerequisites
The project to be moved has never been analyzed on the target instance.
The target instance must be Enterprise Edition or above.
The source instance can be a SonarQuber Server or a SonarQube Community Build instance.
Both source and target instances must have:
If your source instance is a SonarQube Server instance: the exact same SonarQube Server version.
The same custom metrics.
The same custom rules
The target instance must have all the plugins of the source instance, with the same versions. 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.
Preliminary step if moving from a SonarQube Community Build instance
If your source instance is a SonarQube Community Build instance, a preliminary step is necessary before performing Step 1 to Step 3 below:
Create a new SonarQube Server Enterprise Edition of the same version as the target instance from the database of your SonarQube Community Build instance (no license is required). This Enterprise Edition instance becomes your source instance.
Step 1: Export the source project to a ZIP file
On the source instance (if the source instance was originally a SonarQube Community Build instance, go directly to 3.):
Review the branches of the project by navigating to Project Settings > Branches & Pull Requests and enable Keep when inactive for each branch you want to keep. Note that pull requests are not saved when exporting a project.
Reanalyze the project one last time for each branch that has enabled the Keep when inactive option to ensure it is populated with data corresponding to your current SonarQube Server installation.
Navigate to the project and at the project level, choose Project Settings > Import / Export.
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 a file named:
<sonarqubeHome>/data/governance/project_dumps/export/<project_key>.zip
where <sonarqubeHome>:
For a ZIP installation: is the location where the SonarQube Server distribution has been unzipped.
For a Docker installation: is the installation directory of SonarQube Server within your container. This path is stored in the SONARQUBE_HOME environment variable.
If the source instance is a Data Center Edition instance, the ZIP file is generated on the application node that processed the export. You have to find out which one to copy the ZIP file from there.
Step 2: Create the target project and import the ZIP file
The procedure is different depending on the target instance edition.
Step 3: Trigger an analysis on the moved project
The export ZIP file does not include source code and security reports. Once the import is finished, trigger an analysis to import source files into the new instance and generate security reports.
Note that if the import is done without SCM data, the code will be considered new code and the analysis may provide imprecise results.
Last updated
Was this helpful?