How to export projects with it's subprojects?

(Yash Brahmani) #1

Must-share information (formatted with Markdown):

  • which versions are you using (SonarQube, Scanner, Plugin, and any relevant extension
  • what are you trying to achieve
    Migration the projects from one instance to another
  • what have you tried so far to achieve this
    We have tried using import export api for projects.
    There are various subprojects as well and each of them has a different project key which does not match with it’s name.
    Can you provide some suggestions on this please.

Yash Brahmani

(G Ann Campbell) #2


Could you expand this please with the results of your attempts?


(Yash Brahmani) #3

Hi Ann,
When I use sonar_url/api/index/status , it lists all the project keys and measures but I wanted to know how can I segregate and export the projects and subprojects.?
Do I have to export even the sub-projects as well?
I am creating a custom solution which will export the projects such that it can be accommodated in an individual instance. We currently have a single instance for all the projects. We are in a migration phase and require a technique to do this easily with api.
Thank you

Yash Brahmani

(Yash Brahmani) #4

I am using /api/projects_dump/export and /api/qualityprofiles/backup

(G Ann Campbell) #5

Hi Yash,

It’s not clear to me what you mean by “subproject”. Do you mean “module” (as on Maven module)? If so, then you should see that an exported project includes all its modules, and you should see that on import all those modules are properly recreated in the project in the new instance. I’m not sure what else you would expect. It is not possible to extract modules directly.


(Yash Brahmani) #6

Hi Ann,
We have 3084 projects in legacy instance
The naming is as follows:

Likewise we have around 3084 projects but the actually projects will be less for example say 1000projects.
And others will be it’s submodules.
Correct me if I am wrong here.

The question is:
Will I have to export all the 3084 projects or is there another way round.

Yash Brahmani

(G Ann Campbell) #7

Hi Yash,

To be clear, you have what SonarQube sees as 3084 completely independent Projects that just happen to share some substrings in their names?

In that case, yes, you’ll need to export/import each one independently.


(Yash Brahmani) #8

Alright Ann
But this should not be the case right there should be a project folder within which all respective subprojects have to be present.
As a result when the user exports the project,the projects should be exported with all it’s sub-projects.
Is that a problem with sonarqube or the way we analyse the project needs to be changed?