The last post about SonarQube described an update of version. Unfortunately, I was a bit late between the time I did the upgrade and when I wrote the post, so that in the meantimes, a new version of SonarQube has been available.
This is a version 4.0 (so, a major one), that I did install this weekend. And as I did some errors, this is an opportunity to update this post SonarQube upgrade and to document these error messages and how I solved them.
I will not detail all the steps of upgrade as in the previous article, but simply specify the errors encountered.
These steps are:
- First, verify that SonarQube is not enabled. If this is the case, stop the Sonar service.
- Do a backup of your SonarQube current environment. We already have seen how to do a backup of your Oracle database.
- Uninstall the existing Sonar service. We can delete it with the ‘UninstallNTService.bat’ that you can find in the folder corresponding to our operating system, in the directory ‘..\bin’ of the current release of SonarQube.
Note: I did try this uninstall with any other ‘UninstallNTService.bat’ file, from another version or from a 32 or 64 bits release and it works.
I will then download the version 4.0 ofSonarQube, from this page on SonarSource.
SonarQube 4.0 installation
Then I proceed as usual:
- Unzip of the SonarQube 4.0 release in its own directory.
- Copy of the .jar files of the installed plugins (from the previous version) into the corresponding folder in the new version: ‘..\sonar-4.0\extensions\plugins’.
- Copy of the Oracle database driver ‘ojdbc6.jar’ into the new folder ‘..\sonar-4,0\extensions\jdbc-driver\oracle’ (as I use an Oracle database).
- Copy of the files ‘sonar.properties’ (with the environment parameters) and ‘wrapper.conf’ into the new directory ‘..\sonar-4.0\conf’. Beware: if you are following this post step by step, don’t do this one as it is erroneous (see hereunder)..
- Install the new Windows service Sonar in its 4.0 version, with the file ‘InstallNTService.bat’ that you will find under the directory ‘sonar-4,0\bin\’ and in the sub-directory corresponding to your OS.
And the file ‘sonar.log’ displays this error: WrapperSimpleApp: Encountered an error running main: java.lang.IllegalStateException: Do not copy-paste the configuration files (conf directory) from the old version. Update the content of the new files instead.
As always, I did consult the Releases Notes page, but I did not take care to the upgrade page that has been modified: it now explains that you must not copy anymore the configuration files, but update them instead. So the previous step 4 was not correct.
In fact, I did not modify the file ‘wrapper.conf’ but only the ‘sonar.properties’ file with the indication of the Oracle database. Once our configuration is done, we can lauch the upgrade procedure from the ‘setup’ page ‘http://localhost:9000/setup’.
SonarQube must do an upgrade of the database:
Update of the Sqale plugin
So, I will look to the page related to this plugin on the SonarSource website :
We can find a new version of this plugin, that works specifically with the version 4.0 of SonarQube.
So I will:
- Download this plugin into the directory ‘..\sonar-4.0\extensions\plugins’.
- Stop / Start the new Windows service Sonar.
- Launch again the setup of SonarQube : ‘http://localhost:9000/setup’
Yes! The upgrade has been done correctly.
Update of other plugins
The previous example showed us that sometimes it may be necessary to install a new version of a plugin before installing a new version of SonarQube. This is why it is recommended to do these updates through the Update Center, as we saw inl the post SonarQube upgrade,
So I will follow the same procedure:
- Connect as a Sonar admin
- Go to the Update Center and activate the upgrade of the plugins that require an update:
Note that the upgrade from Java 1.4 to Java 1.5 results in an update of different plugins (findbugs, pmd, etc).
Once we have activated the upgrade of all the plugins that need to be upddated, we can Re-start the Windows service Sonar and get back to SonarQube.
Et voilà ! We can now discover what is new in this 4.0 version and these new plugins. See you soon for a new post.