{"id":455,"date":"2013-05-05T08:58:41","date_gmt":"2013-05-05T07:58:41","guid":{"rendered":"http:\/\/qualilogy.com\/en\/?p=455"},"modified":"2013-09-01T16:02:28","modified_gmt":"2013-09-01T15:02:28","slug":"install-sonarqube-the-sonarqub-jenkins-plugin","status":"publish","type":"post","link":"http:\/\/qualilogy.com\/en\/install-sonarqube-the-sonarqub-jenkins-plugin\/","title":{"rendered":"Install SonarQube &#8211; The SonarQube Jenkins plugin"},"content":{"rendered":"<p><a href=\"http:\/\/vicken.deviantart.com\/\" target=\"_blank\"><img loading=\"lazy\" decoding=\"async\" class=\"alignright size-full wp-image-786\" alt=\"Installer Sonar - Le plugin Sonar pour Jenkins\" src=\"http:\/\/qualilogy.com\/fr\/wp-content\/uploads\/sites\/2\/2013\/05\/SonarJenkinsPlugin.jpg\" width=\"232\" height=\"350\" \/><\/a><span id=\"result_box\" lang=\"en\"><span class=\"hps\">After installing<\/span> <span class=\"hps\">Jenkins<\/span><span>,<\/span> <span class=\"hps\">we will now see<\/span> <span class=\"hps\">how to interface<\/span> <span class=\"hps\">it with<\/span> <span class=\"hps\">our<\/span> <span class=\"hps\">SonarQube<\/span> <span class=\"hps\">environment.<\/span><\/span><\/p>\n<p>If you have not been following along this series about creating an <a title=\"Sonar Installation\" href=\"http:\/\/qualilogy.com\/en\/category\/sonar\/sonar-installation\/\" target=\"_blank\">environment of code analysis with Sonar<\/a>Qube, here are the items we need today:<\/p>\n<ul>\n<li><a title=\"Installer Sonar - Installation d'un JDK\" href=\"http:\/\/qualilogy.com\/en\/install-sonar-jdk\/\" target=\"_blank\">Installing a Java JDK<\/a>.<\/li>\n<li>The <a title=\"Installer Sonar\" href=\"http:\/\/qualilogy.com\/en\/install-sonar-the-sonar-webap\/\" target=\"_blank\">installation of SonarQube<\/a>.<\/li>\n<li>And the previous post about the <a title=\"Installer Sonar - Installation de Jenkins\" href=\"http:\/\/qualilogy.com\/en\/install-sonar-jenkins\/\" target=\"_blank\">installation of Jenkins<\/a>.<\/li>\n<\/ul>\n<p>You can also have a look at the documentation about configuring the <a title=\"Sonar Jenkins Plugin\" href=\"http:\/\/docs.codehaus.org\/display\/SONAR\/Configuring+Sonar+Jenkins+Plugin\" target=\"_blank\">SonarQube Jenkins Plugin<\/a>, on the SonarSource website.<\/p>\n<p><!--more--><\/p>\n<h2>Download and install the plugin SonarQube Jenkins<\/h2>\n<p>Let&#8217;s start by launching Jenkins, the web application of the same name under Tomcat, located at\u00a0 http:\/\/localhost:8888\/jenkins in my environment.<\/p>\n<p><span id=\"result_box\" lang=\"en\"><span class=\"hps\">In<\/span> <span class=\"hps\">the Administration page<\/span> <span class=\"hps\">of<\/span> <span class=\"hps\">Jenkins,<\/span> <span class=\"hps\">activate the menu<\/span> to <span class=\"hps\">manage<\/span> <span class=\"hps\">plugins:<\/span><\/span><\/p>\n<p><a href=\"http:\/\/qualilogy.com\/fr\/wp-content\/uploads\/sites\/2\/2013\/05\/JenkinsAdminMenu.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-795\" alt=\"JenkinsAdminMenu\" src=\"http:\/\/qualilogy.com\/fr\/wp-content\/uploads\/sites\/2\/2013\/05\/JenkinsAdminMenu.jpg\" width=\"577\" height=\"71\" \/><\/a><\/p>\n<p>On the next page, select the tab for all the available plugins: <a href=\"http:\/\/qualilogy.com\/fr\/wp-content\/uploads\/sites\/2\/2013\/05\/JenkinsUpdateCenter.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-792\" alt=\"JenkinsUpdateCenter\" src=\"http:\/\/qualilogy.com\/fr\/wp-content\/uploads\/sites\/2\/2013\/05\/JenkinsUpdateCenter.jpg\" width=\"600\" height=\"86\" \/><\/a><\/p>\n<p>Search and select the SonarQube plugin. I suggest you do a search on the string &#8216;Sonar&#8217; to quickly find the plugin in this particularly long list.<\/p>\n<p>At the bottom of the page, click the button &#8216;Install without restart&#8217;: <img loading=\"lazy\" decoding=\"async\" class=\"alignright size-full wp-image-793\" alt=\"JenkinsBoutonInstaller\" src=\"http:\/\/qualilogy.com\/fr\/wp-content\/uploads\/sites\/2\/2013\/05\/JenkinsBoutonInstaller.jpg\" width=\"126\" height=\"28\" \/> Jenkins starts the installation and once it is finished&#8230;<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignleft size-full wp-image-794\" alt=\"JenkinsPluginUpdated\" src=\"http:\/\/qualilogy.com\/fr\/wp-content\/uploads\/sites\/2\/2013\/05\/JenkinsPluginUpdated.jpg\" width=\"202\" height=\"34\" \/> &#8230;\u00a0 tells us that the SonarQube plugin has been updated. We can return to the Administration page of Jenkins to select the setup menu, which will allow us to set our SonarQube installation.<\/p>\n<h2>Configuring the SonarQube Runner<\/h2>\n<p>Jenkins will use the SonarQube Runner (that we have <a title=\"Installer Sonar Runner\" href=\"http:\/\/qualilogy.com\/en\/install-sonar-sonar-runner\/\" target=\"_blank\">installed previously<\/a>) to run analysis of code.<\/p>\n<p><a href=\"http:\/\/qualilogy.com\/fr\/wp-content\/uploads\/sites\/2\/2013\/05\/JenkinsConfigSystem.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"alignleft size-full wp-image-797\" alt=\"JenkinsConfigSystem\" src=\"http:\/\/qualilogy.com\/fr\/wp-content\/uploads\/sites\/2\/2013\/05\/JenkinsConfigSystem.jpg\" width=\"325\" height=\"65\" \/><\/a>In order to configure it, we return to the Administration page of Jenkins to activate the menu of configuration.<\/p>\n<p>Notice in this page the first line indicating the working directory of Jenkins, that we have configured in <a href=\"http:\/\/qualilogy.com\/en\/install-sonar-jenkins\/\" target=\"_blank\">the previous post<\/a>.<a title=\"Installer Sonar - Installation de Jenkins\" href=\"http:\/\/qualilogy.com\/fr\/installer-sonar-jenkins\/\" target=\"_blank\"><br \/>\n<\/a><\/p>\n<p>Then, Jenkins proposes us to configure or even install a JDK.<\/p>\n<p><a href=\"http:\/\/qualilogy.com\/fr\/wp-content\/uploads\/sites\/2\/2013\/05\/JenkinsConfigJDK.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-804\" alt=\"JenkinsConfigJDK\" src=\"http:\/\/qualilogy.com\/fr\/wp-content\/uploads\/sites\/2\/2013\/05\/JenkinsConfigJDK.jpg\" width=\"561\" height=\"73\" \/><\/a><\/p>\n<p>This is not necessary if you have proceeded as indicated during the <a title=\"Installer Sonar - Installation d'un JDK\" href=\"http:\/\/qualilogy.com\/en\/install-sonar-jdk\/\" target=\"_blank\">installation of a Java JDK<\/a>, creating a JAVA_HOME variable and declaring in the path of your PC, the directory containing the java executables (%JAVA_HOME%\\bin).<\/p>\n<p>Below, a section devoted to the SonarQube Runner will allow us to configure it. First, click the button to add an instance of SonarQube Runner.<\/p>\n<p><a href=\"http:\/\/qualilogy.com\/fr\/wp-content\/uploads\/sites\/2\/2013\/05\/JenkinsAddSonarRunner.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-799\" alt=\"JenkinsAddSonarRunner\" src=\"http:\/\/qualilogy.com\/fr\/wp-content\/uploads\/sites\/2\/2013\/05\/JenkinsAddSonarRunner.jpg\" width=\"609\" height=\"74\" \/><\/a><\/p>\n<p>This will open a section to enter its configuration:<\/p>\n<p><a href=\"http:\/\/qualilogy.com\/fr\/wp-content\/uploads\/sites\/2\/2013\/05\/JenkinsConfigSonarRunner.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-800\" alt=\"JenkinsConfigSonarRunner\" src=\"http:\/\/qualilogy.com\/fr\/wp-content\/uploads\/sites\/2\/2013\/05\/JenkinsConfigSonarRunner.jpg\" width=\"621\" height=\"198\" \/><\/a><\/p>\n<p>In this section:<\/p>\n<ul>\n<li>Uncheck the automatic installation option.<\/li>\n<li>Enter a name for you SonarQube Runner instance.<\/li>\n<li>Enter its localisation.<\/li>\n<\/ul>\n<p>And finally, do not forget to save your settings. It&#8217;s done.<\/p>\n<h2>Configuring SonarQube<\/h2>\n<p>The configuration of SonarQube into Jenkins will follow the same logic. In this same configuration page of the &#8216;Jenkins system&#8217;, locate the section dedicated to SonarQube:<\/p>\n<p><a href=\"http:\/\/qualilogy.com\/fr\/wp-content\/uploads\/sites\/2\/2013\/05\/JenkinsAddSonar.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-801\" alt=\"JenkinsAddSonar\" src=\"http:\/\/qualilogy.com\/fr\/wp-content\/uploads\/sites\/2\/2013\/05\/JenkinsAddSonar.jpg\" width=\"504\" height=\"80\" \/><\/a><\/p>\n<p>Again, click the button to create a new SonarQube instance.<\/p>\n<p><a href=\"http:\/\/qualilogy.com\/fr\/wp-content\/uploads\/sites\/2\/2013\/05\/JenkinsAddSonarName.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"alignright size-full wp-image-808\" alt=\"JenkinsAddSonarName\" src=\"http:\/\/qualilogy.com\/fr\/wp-content\/uploads\/sites\/2\/2013\/05\/JenkinsAddSonarName.jpg\" width=\"327\" height=\"57\" \/><\/a>Jenkins then asks to enter a name to identify this SonarQube installation.<\/p>\n<p><a href=\"http:\/\/qualilogy.com\/fr\/wp-content\/uploads\/sites\/2\/2013\/05\/JenkinsAddSonarAdvanced.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"alignleft size-full wp-image-810\" alt=\"JenkinsAddSonarAdvanced\" src=\"http:\/\/qualilogy.com\/fr\/wp-content\/uploads\/sites\/2\/2013\/05\/JenkinsAddSonarAdvanced.jpg\" width=\"116\" height=\"59\" \/><\/a>Now, you can activate the button &#8216;Advanced&#8230;&#8217; (&#8216;Avanzado&#8230;&#8217; in my interface) to open a page that will allow us to enter the different configuration settings.<\/p>\n<p>These are the same as those listed in our &#8216;sonar-properties&#8217; file, to configure SonarQube. So just open this file to use the same parameters:<\/p>\n<p><a href=\"http:\/\/qualilogy.com\/fr\/wp-content\/uploads\/sites\/2\/2013\/05\/JenkinsAddSonarParams.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-811\" alt=\"JenkinsAddSonarParams\" src=\"http:\/\/qualilogy.com\/fr\/wp-content\/uploads\/sites\/2\/2013\/05\/JenkinsAddSonarParams.jpg\" width=\"672\" height=\"406\" \/><\/a><\/p>\n<p>We indicate:<\/p>\n<ul>\n<li>The url of our SonarQube web application.<\/li>\n<li>The access to our database.<\/li>\n<li>The JDBC driver.<\/li>\n<\/ul>\n<p>I mentioned also the Oracle user and password to access the SonarQube schema (even if I actually used the default values). I did not include a SonarQube user to perform the analyzes, since I had not done it either during the installation of the SonarQube Runner.<\/p>\n<p><a href=\"http:\/\/qualilogy.com\/fr\/wp-content\/uploads\/sites\/2\/2013\/05\/JenkinsAddSonarGuardar.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"alignleft size-full wp-image-814\" alt=\"JenkinsAddSonarGuardar\" src=\"http:\/\/qualilogy.com\/fr\/wp-content\/uploads\/sites\/2\/2013\/05\/JenkinsAddSonarGuardar.jpg\" width=\"76\" height=\"41\" \/><\/a>Don&#8217;t forget to save your settings with the button located at the end of the page.<\/p>\n<p>Et voil\u00e0. Now we can use Jenkins to create and run SonarQube analysis.<\/p>\n<p>This will be the subject of our next post. Very soon.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>After installing Jenkins, we will now see how to interface it with our SonarQube environment. If you have not been following along this series about creating an environment of code analysis with SonarQube, here are the items we need today: Installing a Java JDK. The installation of SonarQube. And the previous post about the installation [&hellip;]<\/p>\n","protected":false},"author":3,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[7],"tags":[],"class_list":["post-455","post","type-post","status-publish","format-standard","hentry","category-sonar-installation"],"_links":{"self":[{"href":"http:\/\/qualilogy.com\/en\/wp-json\/wp\/v2\/posts\/455"}],"collection":[{"href":"http:\/\/qualilogy.com\/en\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/qualilogy.com\/en\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/qualilogy.com\/en\/wp-json\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"http:\/\/qualilogy.com\/en\/wp-json\/wp\/v2\/comments?post=455"}],"version-history":[{"count":16,"href":"http:\/\/qualilogy.com\/en\/wp-json\/wp\/v2\/posts\/455\/revisions"}],"predecessor-version":[{"id":616,"href":"http:\/\/qualilogy.com\/en\/wp-json\/wp\/v2\/posts\/455\/revisions\/616"}],"wp:attachment":[{"href":"http:\/\/qualilogy.com\/en\/wp-json\/wp\/v2\/media?parent=455"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/qualilogy.com\/en\/wp-json\/wp\/v2\/categories?post=455"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/qualilogy.com\/en\/wp-json\/wp\/v2\/tags?post=455"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}