Migrate sonar data from old to new sonar version

less than 1 minute read

At my current project we were setting up a new buildserver. One of the things we had to do was move an old sonar implementation running on top of H2 to a new version running on Oracle. The problem was that just migrating the data is nearly impossible to do when you start with H2, and when the versions were so far apart as in our case. During some research we stumbled upon the following migration Gist page showing a possible migration path: https://gist.github.com/aslakknutsen/2422117

What the example script on that page does, is that it retieves all the tags from a Git repository and just starts running maven and the sonar plugin to refill the new sonar. With a couple of additions and changes we managed to get this running for our scenario and were able to refill our new sonar with historical data:

The above code was run against with SonarQube 4.5.2, but should also work with SonarQube 5.x.

Updated: