{"id":51,"date":"2011-06-11T23:34:47","date_gmt":"2011-06-11T23:34:47","guid":{"rendered":"http:\/\/choudhury.com\/blog\/?p=51"},"modified":"2011-08-06T14:57:50","modified_gmt":"2011-08-06T14:57:50","slug":"setting-up-sonar","status":"publish","type":"post","link":"https:\/\/choudhury.com\/blog\/2011\/06\/11\/setting-up-sonar\/","title":{"rendered":"Setting up Sonar"},"content":{"rendered":"<p>Sonar is great tool for static code analysis. This is a quick how to guide on setting up sonar..<br \/>\nPrerequisites, make sure you have Java SDK installed.<\/p>\n<p>(1) Download sonar from <a href=\"http:\/\/www.sonarsource.org\/downloads\/\">sonar<\/a><\/p>\n<p>(2) Unzip the the zip to a folder of your choice.<\/p>\n<p>(3) In the how to for sonar, they advice you use mysql as the database &#8211; which is a good advice, but if you just want to use the derby database provided out of the box, the derby database is good enough.<\/p>\n<p>Useful tip to save you some time, I want to setup my sonar server on different host to where the build system is. If you also want to do this, then you need to go to the conf folder,<\/p>\n<p><a href=\"https:\/\/choudhury.com\/blog\/wp-content\/uploads\/2011\/06\/sonar_conf_folder.png\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/choudhury.com\/blog\/wp-content\/uploads\/2011\/06\/sonar_conf_folder.png\" alt=\"\" title=\"sonar_conf_folder\" width=\"672\" height=\"336\" class=\"alignnone size-full wp-image-57\" srcset=\"https:\/\/choudhury.com\/blog\/wp-content\/uploads\/2011\/06\/sonar_conf_folder.png 672w, https:\/\/choudhury.com\/blog\/wp-content\/uploads\/2011\/06\/sonar_conf_folder-300x150.png 300w\" sizes=\"auto, (max-width: 672px) 100vw, 672px\" \/><\/a><\/p>\n<p>Edit the file: sonar.properties  <\/p>\n<p>and uncomment the line<\/p>\n<div class=\"codecolorer-container properties default\" style=\"overflow:auto;white-space:nowrap;\"><div class=\"properties codecolorer\"><span class=\"co1\"># uncomment to accept connections from remote hosts. Ba default it only accepts localhost connections.<\/span><br \/>\nsonar.derby.drda.host: 0.0.0.0<\/div><\/div>\n<p>by uncommenting the above line you allow clients on other boxes to connect to the derby database.<\/p>\n<p>Next startup sonar by going to bin\\windows-x86-32  (or the appropriate folder for the OS you are using) and run &#8220;StartSonar.bat&#8221; ( if you plan to run sonar as a service, it&#8217;s worthwhile running the InstallNTService.bat so that Sonar appears in your windows service list). If it&#8217;s the first time you starting sonar, you have to be a little patient as it creates the database under the data folder in sonar. To see what&#8217;s happening,  can tail the log file under logs directory.<\/p>\n<p>You should lots of activity in the sonar.log file and hopefully when sonar is up and running,  you will see see lines appearing in your log.<\/p>\n<p><quote><br \/>\n2011.06.11 17:51:11 INFO  org.sonar.INFO  Register quality models&#8230;<br \/>\n2011.06.11 17:51:11 INFO  org.sonar.INFO  Register quality models done: 2 ms<br \/>\n2011.06.11 17:51:11 INFO  org.sonar.INFO  Start services done: 18139 ms<br \/>\n2011.06.11 17:51:11 INFO  org.sonar.INFO  Loading web services&#8230;<br \/>\n2011.06.11 17:51:11 INFO  org.sonar.INFO  Loading web services&#8230;<br \/>\n2011.06.11 17:51:12 INFO  org.sonar.INFO  Sonar started: http:\/\/0.0.0.0:9000\/<br \/>\n<\/quote><\/p>\n<p>That&#8217;s a good sign! \ud83d\ude42  You should now be able to browse to the sonar page on port 9000 and see something like the following..<\/p>\n<p><a href=\"https:\/\/choudhury.com\/blog\/wp-content\/uploads\/2011\/06\/sonar_new_install.jpg\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/choudhury.com\/blog\/wp-content\/uploads\/2011\/06\/sonar_new_install.jpg\" alt=\"\" title=\"sonar_new_install\" width=\"869\" height=\"355\" class=\"alignnone size-full wp-image-53\" srcset=\"https:\/\/choudhury.com\/blog\/wp-content\/uploads\/2011\/06\/sonar_new_install.jpg 869w, https:\/\/choudhury.com\/blog\/wp-content\/uploads\/2011\/06\/sonar_new_install-300x122.jpg 300w\" sizes=\"auto, (max-width: 706px) 89vw, (max-width: 767px) 82vw, 740px\" \/><\/a><\/p>\n<p>Congratulations you have sonar up and running!<\/p>\n<p>Obviously not very exciting, in the next post, I will go through how to to do static analysis of an existing maven project using sonar. Stay tuned!<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Sonar is great tool for static code analysis. This is a quick how to guide on setting up sonar.. Prerequisites, make sure you have Java SDK installed. (1) Download sonar from sonar (2) Unzip the the zip to a folder of your choice. (3) In the how to for sonar, they advice you use mysql &hellip; <\/p>\n<p class=\"link-more\"><a href=\"https:\/\/choudhury.com\/blog\/2011\/06\/11\/setting-up-sonar\/\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;Setting up Sonar&#8221;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[6,9],"tags":[],"class_list":["post-51","post","type-post","status-publish","format-standard","hentry","category-code-quality","category-maven"],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/choudhury.com\/blog\/wp-json\/wp\/v2\/posts\/51","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/choudhury.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/choudhury.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/choudhury.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/choudhury.com\/blog\/wp-json\/wp\/v2\/comments?post=51"}],"version-history":[{"count":16,"href":"https:\/\/choudhury.com\/blog\/wp-json\/wp\/v2\/posts\/51\/revisions"}],"predecessor-version":[{"id":154,"href":"https:\/\/choudhury.com\/blog\/wp-json\/wp\/v2\/posts\/51\/revisions\/154"}],"wp:attachment":[{"href":"https:\/\/choudhury.com\/blog\/wp-json\/wp\/v2\/media?parent=51"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/choudhury.com\/blog\/wp-json\/wp\/v2\/categories?post=51"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/choudhury.com\/blog\/wp-json\/wp\/v2\/tags?post=51"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}