Sonar Upgrade

It’s been a while since we talked about Sonar. I was a bit busy recently to discover new territories (see previous posts Elastic Software, Quality in the Cloud) so I am late in the update of my Sonar environment. Furthermore, there is a new release 3.0 with a bunch of new features.

So without further ado, the time has come for a Sonar upgrade.

Note that this is an upgrade of our entire environment, not simply of Sonar but also of outdated plugins or to update or to add new plugins. To get an idea of my setup, you can refer to this post Sonar – Our Environment.

We’ll start by checking:

  1. The plugins we want to quit: I tested a few plugins for which a license is needed and it has expired. I will remove those plugins.
  2. The plugins we want to upgrade, for which there is a new version.
  3. The new plugins we want to install.

Update Center

First, let’s visit the Update Center in Sonar with a login as Administrator.

Then ‘Configuration’ / ‘Update Center’…

and in this screen, we can see:

  • Installed plugins.
  • Available plugins not installed.
  • Installed plugins with a new release available.
  • New Sonar release(s) available.

The screen below shows four possible updates of plugins, of which one (the plugin Views) is incompatible with the current version of Sonar and will necessitate an upgrade of Sonar.

The update of my Sonar environment Sonar will therefore consist of:

  1. Remove obsolete plugins.
  2. Upgrade existing plugins.
  3. Upgrade Sonar.
  4. Upgrade of the plugin Views / installation of new plugins.

Removing plugins

To delete an existing plugin, simply select it from the tab ‘Installed Plugins’ to see its description and a button ‘Uninstall’.

You can select multiple plugins to uninstall.

It is necessary to restart Sonar to see the updates. In our environment, it requires a Stop / Start of Tomcat.

Hey, I forgot to backup my Sonar database schema. Let’s do it while Tomcat is stopped.

Backup of the Oracle Sonar schema

I do my dumps using the command line EXPort with the following parameters:

  • file: the filename of the dump;
  • log: a log file to verify that the dump is correct;
  • userid: the connexion settings to my Oracle instance, for the schema to backup.

Simpler is not possible.

Once the backup has completed without warnings, I can see the .dmp and .log files created in the backup directory where I did run the ‘EXP’ command.

Start Tomcat and return to the Update Center: the removed plugins no longer appear in the tab ‘Installed Plugins’.

Plugins upgrade

Upgrading plugins is done through a similar procedure.

In the ‘Plugin Updates’ tab, click on the button to upgrade to the new version for each plugin to update.

Again, you can update multiple versions at once. Then again Stop / Start of the Tomcat server in order to see the new releases of the plugins in the Update Center.

Except for the Views plugin that needs an upgrade of Sonar. That’s what we will do now.

Sonar Upgrade

The upgrade procedure is simple and logical, but I will systematically consult the Upgrade Guide, as it is easy to forget something.

First, get a zip of the new Sonar release 3.0 from the download page and extract it to a new directory: ‘C:\Soft\sonar\sonar-3.0’, in my environment.

We will then recover files specific to our environment fom the previous version (2.13.1 on my machine) to the new version:

  1. Copy the files ‘’ (with the parameters of the environment) and ‘wrapper.conf’ from ‘C:\Soft\Sonar\sonar-2.13.1\conf’ to ‘C:\Soft\Sonar\sonar-3.0\conf’.
  2. Copy the files .jar of the plugins installed in our current environment from ‘C:\Soft\Sonar\sonar-2.13.1\extensions\plugins’ to ‘C:\Soft\Sonar\sonar-3.0\extensions\plugins’.
  3. Copy the driver ‘C:\Soft\Sonar\sonar-2.13.1\extensions\jdbc-driver\oracle\ojdbc6.jar’ to the directory ‘C:\Soft\Sonar\sonar-3.0\extensions\jdbc-driver\oracle’ (depending on the database you are using).
  4. Create a new .war file to be installed under Tomcat, for this new Sonar release: launch the ‘C:\Soft\Sonar\sonar-3.0\war\build-war.bat’, that will create in this same directory a ‘sonar.war’ file.

Then, I will copy this ‘sonar.war’ file under Tomcat (I will do first a backup of the existing ‘sonar.war’ corresponding to the current Sonar release).

Note: it is best to update first your Sonar environment with the deletion or update of plugins before installing a new version since (point 2 above) we copy the .jar files of these plugins to the directory of the new Sonar version.

Once Tomcat and Sonar restarted, you could get the following message:

The first time, I thought I did something wrong or that I had forgotten something. This is the reason why I systematically consult the Upgrade Guide: there is a last step that consists in updating the database from the Sonar ‘setup’ page. In my environment: http://localhost:8888/sonar/setup.

Upgrading (Sonar post-upgrade) / adding plugins

You remember that the latest version of the plugin Views only works with Sonar 3.0. As we have now installed it, we can now perform this ‘Views’ upgrade.

Again, you have to log in to access the Admin Update Center and proceed with the upgrade from the tab ‘Plugin Updates’:

I will also go into the tab ‘Available Plugins’ and add new plugins, as for instance ‘XML’, ‘Violation density’, ‘Sonar Tab Metrics’.

The process is the same than before: Stop / Start Tomcat.

Back in the Update Center, I can now verify the upgrade of the plugin Views and the installation of new plugins.

Et voilà. You just have to launch a new analysis of your projects.

We have seen all possible cases of updating our Sonar environment: remove plugins, update/add plugins and upgrade Sonar release.

You can easily adapt this procedure to your own environment. Remember to always consult the upgrade guide and release notes.

I let you enjoy these new features.

Leave a Reply

Your email address will not be published. Required fields are marked *