Install SonarQube – Jenkins

Install JenkinsIn this series of posts on the installation and configuration of SonarQube, we have seen how to realise a first analysis of code with the SonarQube Runner.

Today we will see how to install and configure Jenkins that we will use (later) to manage all our analysis.

This is also an opportunity to detail the resolution of some problems specific to our environment, and incidentally to see how to detect these problems with the Tomcat server, which we have installed previously.

Installing Jenkins

Download JenkinsAs for SonarQube, we chose to install Jenkins as a .war file, that we download from the Jenkins home page.

I’ll keep this file ‘jenkins.war’ in a folder dedicated to managing different versions of SonarQube, its plugins, and Jenkins, before to copy it in Tomcat’s directory ‘C:\Program Files (x86)\Apache Software Foundation\Tomcat 7.0\webapps’.

Tomcat will then deploy this .war a Web application which we can then access from our browser with the following URL http://localhost:8888/jenkins/. Remember: ‘8888’ is the port I did choose during Tomcat’s nstallation.

Tomcat’s error log

My browser is running a few minutes … then eventually displays the following error: ‘PermGen space’.

Jenkins erreur PermGen Space

This will allow us to see how to identify a problem with Tomcat. The logs files are found into the directory ‘..\Apache Software Foundation\Tomcat 7.0\logs’. There are different log files, mais when you encounter an error, you should see a file ‘tomcat7-stderr.xx.log’ (with xx the date).

Open this file you will see the cause of the error with a message ‘java.lang.OutOfMemoryError: PermGen space’.

Without details, the ‘PermGen space’ is the memory space reserved for the storage of Java classes and its related information. We need to upgrade our Tomcat configuration, as follows:

  • Launch the ‘Tomcat7w.exe’ file (you can find it in the folder ‘..\Apache Software Foundation\Tomcat 7.0\bin’).
  • In the Java tab, enter the following option: -XX:MaxPermSize=256m.

Tomcat PermGen space

Don’t forget to click the ‘Apply’ button, and then ‘OK’ to close this program. Then, you need to do a Stop / Start of the Tomcat service.

JenkinsMenuRestart Jenkins in your browser. Et voilá: Jenkins main screen finally appears.

Notice my spanish interface: Jenkins automatically detects the language to use with the corresponding variable in your browser (and yes, I live in Madrid).

Good. Let’s take a look at the configuration of Jenkins, from the menu / the administration link (‘Administrar Jenkins’ in my case).

Configuring Jenkins

In the administration page, a message tells me that the servlet container ie Tomcat – is not UTF8 compliant, which could cause problems with non-ASCII characters.

We will solve this problem as follows:

  • In the folder ‘..\Apache Software Foundation\Tomcat 7.0\conf’, look for the file ‘server.xml’.
  • In this file, look for the section ‘Connector’ and insert the following line:


Here is what it looks like in my file:


Again, do a restart of the Tomcat service and verify that the error message has disappeared from the administration page of Jenkins,

From this page, we will now see the configuration settings by selecting the first menu on this page (‘Configurar El Sistema’ in spanish).

The first line in this configuration page indicates that Jenkins is installed in a directory ‘C:\.jenkins’. I don’t want that. I want to have all the softwares I use in a ‘C:\Soft’ directory and all about my code analysis in a folder ‘C:\SRC’ (for instance). . So I need it to change the location parameter of the Jenkins ‘repository’.

In order to do this, we will specify a variable ‘JENKINS HOME’, as follows : in the folder ‘..\Apache Software Foundation\Tomcat 7.0\conf’, look for the ‘context.xml’ file and insert the following line:

<Environment name=”JENKINS_HOME” value=”C:/SRC/Jenkins/” type=”java.lang.String”/>


I recommand that you carefully choose the directory where you want to locate the Jenkins repository Jenkins: If you change it later, you will lose the existing configuration (except if you move your current repository to the new location), and then all you may have installed, such as the SonarQube plugin for Jenkins, for example.

Plugin that we will install in a future post.

See you soon.

This post is also available in Leer este articulo en castellano and Lire cet article en français.

Leave a Reply

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