{"id":441,"date":"2013-04-29T14:29:32","date_gmt":"2013-04-29T13:29:32","guid":{"rendered":"http:\/\/qualilogy.com\/en\/?p=441"},"modified":"2013-09-01T18:20:12","modified_gmt":"2013-09-01T17:20:12","slug":"install-sonarqube-jenkins","status":"publish","type":"post","link":"http:\/\/qualilogy.com\/en\/install-sonarqube-jenkins\/","title":{"rendered":"Install SonarQube &#8211; Jenkins"},"content":{"rendered":"<p><a href=\"http:\/\/vicken.deviantart.com\/\" target=\"_blank\"><img loading=\"lazy\" decoding=\"async\" class=\"alignright size-full wp-image-749\" alt=\"Install Jenkins\" src=\"http:\/\/qualilogy.com\/fr\/wp-content\/uploads\/sites\/2\/2013\/04\/JenkinsInstall.jpg\" width=\"274\" height=\"350\" \/><\/a>In this series of posts on the installation and configuration of SonarQube, we have seen how to <a title=\"R\u00e9aliser une analyse de code avec le Sonar Runner\" href=\"http:\/\/qualilogy.com\/en\/install-sonar-first-analysis-with-sonar-runner\/\" target=\"_blank\">realise a first analysis of code with the SonarQube Runner<\/a>.<\/p>\n<p><span id=\"result_box\" lang=\"en\"><span class=\"hps\">Today we will<\/span> <span class=\"hps\">see<\/span> <span class=\"hps\">how to install and<\/span> <span class=\"hps\">configure<\/span> <span class=\"hps\">Jenkins<\/span> that we will use (later) <span class=\"hps\">to manage all<\/span> <span class=\"hps\">our analysis.<\/span><\/span><\/p>\n<p><span id=\"result_box\" lang=\"en\"><span class=\"hps\">This<\/span> <span class=\"hps\">is also an opportunity<\/span> <span class=\"hps\">to detail<\/span> <span class=\"hps\">the resolution of some<\/span> <span class=\"hps\">problems specific to<\/span> <span class=\"hps\">our environment,<\/span> <span class=\"hps\">and incidentally<\/span> <span class=\"hps\">to see<\/span> <span class=\"hps\">how to detect<\/span> <span class=\"hps\">these problems with the<\/span> <span class=\"hps\">Tomcat<\/span> <span class=\"hps\">server<\/span><span>, which we<\/span> have <a title=\"Tomcat installation\" href=\"http:\/\/qualilogy.com\/en\/install-sonar-tomcat\/\" target=\"_blank\">installed <span class=\"hps\">previously<\/span><\/a><span class=\"hps\">.<\/span><\/span><\/p>\n<p><!--more--><\/p>\n<h2>Installing Jenkins<\/h2>\n<p><a href=\"http:\/\/qualilogy.com\/fr\/wp-content\/uploads\/sites\/2\/2013\/04\/JenkinsDownload.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"alignleft size-full wp-image-755\" alt=\"Download Jenkins\" src=\"http:\/\/qualilogy.com\/fr\/wp-content\/uploads\/sites\/2\/2013\/04\/JenkinsDownload.jpg\" width=\"331\" height=\"139\" \/><\/a>As for SonarQube, we chose to install Jenkins as a .war file, that we download from the <a title=\"Jenkins.org\" href=\"http:\/\/jenkins-ci.org\/\" target=\"_blank\">Jenkins home page<\/a>.<\/p>\n<p>I&#8217;ll keep this file &#8216;jenkins.war&#8217; in a folder dedicated to managing different versions of SonarQube, its plugins, and Jenkins, before to copy it in Tomcat&#8217;s directory\u00a0&#8216;C:\\Program Files (x86)\\Apache Software Foundation\\Tomcat 7.0\\webapps&#8217;.<\/p>\n<p>Tomcat will then deploy this .war file.in a Web application which we can then access from our browser with the following URL\u00a0<strong>http:\/\/localhost:8888\/jenkins\/<\/strong>. Remember: &#8216;8888&#8217; is the port I did choose during <a title=\"Tomcat installation\" href=\"http:\/\/qualilogy.com\/en\/install-sonar-tomcat\/\" target=\"_blank\">Tomcat&#8217;s nstallation<\/a>.<\/p>\n<h2>Tomcat&#8217;s error log<\/h2>\n<p>My browser is running a few minutes &#8230; then eventually displays the following error: &#8216;PermGen space&#8217;.<\/p>\n<p><a href=\"http:\/\/qualilogy.com\/fr\/wp-content\/uploads\/sites\/2\/2013\/04\/JenkinsPermGenSpaceErrror.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-759\" alt=\"Jenkins erreur PermGen Space\" src=\"http:\/\/qualilogy.com\/fr\/wp-content\/uploads\/sites\/2\/2013\/04\/JenkinsPermGenSpaceErrror.jpg\" width=\"743\" height=\"249\" \/><\/a><\/p>\n<p>This will allow us to see how to identify a problem with Tomcat. The logs files are found into the directory \u2018..\\Apache Software Foundation\\Tomcat 7.0\\logs\u2019. There are different log files, mais when you encounter an error, you should see a file \u2018tomcat7-stderr.xx.log\u2019 (with xx the date).<\/p>\n<p>Open this file you will see the cause of the error with a message \u2018java.lang.OutOfMemoryError: PermGen space\u2019.<\/p>\n<p>Without details, the &#8216;PermGen space&#8217; is the memory space reserved for the storage of Java classes and its related information. We need to upgrade our Tomcat configuration, as follows:<\/p>\n<ul>\n<li>Launch the &#8216;Tomcat7w.exe&#8217; file (you can find it in the folder \u2018..\\Apache Software Foundation\\Tomcat 7.0\\bin\u2019).<\/li>\n<li>In the Java tab, enter the following option: -XX:MaxPermSize=256m.<\/li>\n<\/ul>\n<p><a href=\"http:\/\/qualilogy.com\/fr\/wp-content\/uploads\/sites\/2\/2013\/04\/TomcatPermGenSpace.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-762\" alt=\"Tomcat PermGen space\" src=\"http:\/\/qualilogy.com\/fr\/wp-content\/uploads\/sites\/2\/2013\/04\/TomcatPermGenSpace.jpg\" width=\"415\" height=\"399\" \/><\/a><\/p>\n<p>Don&#8217;t forget to click the &#8216;Apply&#8217; button, and then &#8216;OK&#8217; to close this program. Then, you need to do a Stop \/ Start of the Tomcat service.<\/p>\n<p><a href=\"http:\/\/qualilogy.com\/fr\/wp-content\/uploads\/sites\/2\/2013\/04\/JenkinsMenu.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"alignright size-full wp-image-763\" alt=\"JenkinsMenu\" src=\"http:\/\/qualilogy.com\/fr\/wp-content\/uploads\/sites\/2\/2013\/04\/JenkinsMenu.jpg\" width=\"268\" height=\"200\" \/><\/a>Restart Jenkins in your browser. Et voil\u00e1: Jenkins main screen finally appears.<\/p>\n<p>Notice my spanish interface: Jenkins automatically detects the language to use with the corresponding variable in your browser (and yes, I live in Madrid).<\/p>\n<p>Good. Let&#8217;s take a look at the configuration of Jenkins, from the menu \/ the administration link (&#8216;Administrar Jenkins&#8217; in my case).<\/p>\n<h2>Configuring Jenkins<\/h2>\n<p><span id=\"result_box\" lang=\"en\"><span class=\"hps\">In the<\/span> <span class=\"hps\">administration page<\/span><span>,<\/span> <span class=\"hps\">a message tells<\/span> <span class=\"hps\">me that<\/span> <span class=\"hps\">the servlet container<\/span> <span class=\"hps\">&#8211;<\/span> <span class=\"hps\">ie<\/span> <span class=\"hps\">Tomcat<\/span> <span class=\"hps\">&#8211; is not<\/span> <span class=\"hps\">UTF8<\/span> <span class=\"hps\">compliant<\/span><span>, which could<\/span> <span class=\"hps\">cause problems<\/span> <span class=\"hps\">with<\/span> <span class=\"hps\">non-ASCII characters<\/span><span>.<\/span> <\/span><\/p>\n<p><span id=\"result_box\" lang=\"en\"><span class=\"hps\">We<\/span> <span class=\"hps\">will solve this problem<\/span> <span class=\"hps\">as follows<\/span><span>:<\/span><\/span><\/p>\n<ul>\n<li>In the folder \u2018..\\Apache Software Foundation\\Tomcat 7.0\\conf\u2019, look for the file \u2018server.xml\u2019.<\/li>\n<li>In this file, look for the section \u2018Connector\u2019 and insert the following line:<\/li>\n<\/ul>\n<p style=\"padding-left: 30px\"><strong>URIEncoding=\u201dUTF-8\u201d<\/strong><\/p>\n<p>Here is what it looks like in my file:<\/p>\n<p><a href=\"http:\/\/qualilogy.com\/fr\/wp-content\/uploads\/sites\/2\/2013\/04\/JenkinsConfigurationUTF8.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-765\" alt=\"JenkinsConfigurationUTF8\" src=\"http:\/\/qualilogy.com\/fr\/wp-content\/uploads\/sites\/2\/2013\/04\/JenkinsConfigurationUTF8.jpg\" width=\"503\" height=\"108\" \/><\/a><\/p>\n<p>Again, do a restart of the Tomcat service and verify that the error message has disappeared from the administration page of Jenkins,<\/p>\n<p>From this page, we will now see the configuration settings by selecting the first menu on this page (&#8216;Configurar El Sistema&#8217; in spanish).<\/p>\n<p>The first line in this configuration page indicates that Jenkins is installed in a directory\u00a0\u2018C:\\.jenkins\u2019. I don&#8217;t want that. I want to have all the softwares I use in a \u2018C:\\Soft\u2019 directory and all about my code analysis in a folder \u2018C:\\SRC\u2019 (for instance).\u00a0. So I need it to change the location parameter of the Jenkins &#8216;repository&#8217;.<\/p>\n<p>In order to do this, we will specify a variable \u2018JENKINS HOME\u2019, as follows : in the folder \u2018..\\Apache Software Foundation\\Tomcat 7.0\\conf\u2019, look for the \u2018context.xml\u2019 file and insert the following line:<\/p>\n<p style=\"padding-left: 30px\"><strong>&lt;Environment name=\u201dJENKINS_HOME\u201d value=\u201dC:\/SRC\/Jenkins\/\u201d type=\u201djava.lang.String\u201d\/&gt;<\/strong><\/p>\n<p><a href=\"http:\/\/qualilogy.com\/fr\/wp-content\/uploads\/sites\/2\/2013\/04\/JenkinsContextConf1.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-776\" alt=\"JenkinsContextConf\" src=\"http:\/\/qualilogy.com\/fr\/wp-content\/uploads\/sites\/2\/2013\/04\/JenkinsContextConf1.jpg\" width=\"734\" height=\"71\" \/><\/a><\/p>\n<p>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.<\/p>\n<p>Plugin that we will install in a future post.<\/p>\n<p>See you soon.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>In 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 [&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-441","post","type-post","status-publish","format-standard","hentry","category-sonar-installation"],"_links":{"self":[{"href":"http:\/\/qualilogy.com\/en\/wp-json\/wp\/v2\/posts\/441"}],"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=441"}],"version-history":[{"count":12,"href":"http:\/\/qualilogy.com\/en\/wp-json\/wp\/v2\/posts\/441\/revisions"}],"predecessor-version":[{"id":631,"href":"http:\/\/qualilogy.com\/en\/wp-json\/wp\/v2\/posts\/441\/revisions\/631"}],"wp:attachment":[{"href":"http:\/\/qualilogy.com\/en\/wp-json\/wp\/v2\/media?parent=441"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/qualilogy.com\/en\/wp-json\/wp\/v2\/categories?post=441"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/qualilogy.com\/en\/wp-json\/wp\/v2\/tags?post=441"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}