{"id":9668,"date":"2018-01-20T19:55:50","date_gmt":"2018-01-20T19:55:50","guid":{"rendered":"http:\/\/abstracta.us\/blog\/?p=9668"},"modified":"2025-05-05T21:20:37","modified_gmt":"2025-05-05T21:20:37","slug":"code-analysis-part-3-sonarqube-alternatives","status":"publish","type":"post","link":"https:\/\/abstracta.us\/blog\/software-testing\/code-analysis-part-3-sonarqube-alternatives\/","title":{"rendered":"Code Analysis Part 3: SonarQube Alternatives"},"content":{"rendered":"<p><!-- Go to www.addthis.com\/dashboard to customize your tools --><script src=\"\/\/s7.addthis.com\/js\/300\/addthis_widget.js#pubid=ra-58d80a50fc4f926d\" type=\"text\/javascript\"><\/script><\/p>\n<h1><span style=\"font-weight: 400;\">How to run a code analysis from Maven or an IDE<\/span><\/h1>\n<p><span style=\"font-weight: 400;\">In <\/span><a href=\"http:\/\/abstracta.us\/blog\/software-testing\/code-analysis-part-2-analyzing-code-sonarqube\/\"><span style=\"font-weight: 400;\">part two<\/span><\/a><span style=\"font-weight: 400;\"> of this blog series on code analysis, I showed you how to do a proof of concept quickly using a SonarQube Docker image, and run the analysis from SonarQube Scanner. In this third and final post, we will see two SonarQube alternatives: Maven and an IDE.<\/span><\/p>\n<h2><span class=\"ez-toc-section\" id=\"Running_the_Analysis_with_Maven\"><\/span><strong><span style=\"color: #00b674;\">Running the Analysis with Maven<\/span><\/strong><span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p><span style=\"font-weight: 400;\">To begin with this process, the first thing you must do is add the SonarQube plugin to your Maven project as follows:<\/span><\/p>\n<p><a href=\"http:\/\/abstracta.us\/wp-content\/uploads\/2018\/01\/Screen-Shot-2018-01-20-at-11.06.59-AM-min.png\"><img decoding=\"async\" class=\"aligncenter size-full wp-image-9669\" src=\"http:\/\/abstracta.us\/wp-content\/uploads\/2018\/01\/Screen-Shot-2018-01-20-at-11.06.59-AM-min.png\" alt=\"Screen Shot 2018-01-20 at 11.06.59 AM-min\" width=\"794\" height=\"288\" \/><\/a><\/p>\n<p><span style=\"font-weight: 400;\">(This is for Maven 2, for Maven 3 check <\/span><a href=\"https:\/\/docs.sonarqube.org\/display\/SCAN\/Analyzing+with+SonarQube+Scanner+for+Maven\" target=\"_blank\" rel=\"noopener noreferrer\"><span style=\"font-weight: 400;\">here<\/span><\/a><span style=\"font-weight: 400;\">). <\/span><\/p>\n<p><span style=\"font-weight: 400;\">At this point you have everything necessary to perform your code analysis from Maven, so it will perform the analysis in the SonarQube server that you have already installed in a Docker container (explained <\/span><a href=\"http:\/\/abstracta.us\/blog\/software-testing\/code-analysis-part-2-analyzing-code-sonarqube\/\" target=\"_blank\" rel=\"noopener noreferrer\"><span style=\"font-weight: 400;\">here<\/span><\/a><span style=\"font-weight: 400;\">).<\/span><span style=\"font-weight: 400;\"><br \/>\n<\/span><span style=\"font-weight: 400;\"><br \/>\n<\/span><span style=\"font-weight: 400;\">Then, all that remains is to go to the directory of your project and execute the Maven goal with the following command: <\/span><\/p>\n<p><strong>mvn sonar:sonar -Dsonar.host.url=http:\/\/docker-ip:port<\/strong><\/p>\n<p><span style=\"font-weight: 400;\">The name of the project in SonarQube and the version is taken from the Maven project (at the beginning of the pom file). See the documentation about the parameters <\/span><a href=\"https:\/\/docs.sonarqube.org\/display\/SONAR\/Analysis+Parameters\" target=\"_blank\" rel=\"noopener noreferrer\"><span style=\"font-weight: 400;\">here<\/span><\/a><span style=\"font-weight: 400;\">.<\/span><span style=\"font-weight: 400;\"><br \/>\n<\/span><span style=\"font-weight: 400;\"><br \/>\n<\/span><span style=\"font-weight: 400;\">As a result, you will see something like this:<\/span><\/p>\n<p><a href=\"http:\/\/abstracta.us\/wp-content\/uploads\/2018\/01\/Screen-Shot-2018-01-20-at-11.09.33-AM-min.png\"><img decoding=\"async\" class=\"aligncenter size-full wp-image-9671\" src=\"http:\/\/abstracta.us\/wp-content\/uploads\/2018\/01\/Screen-Shot-2018-01-20-at-11.09.33-AM-min.png\" alt=\"Screen Shot 2018-01-20 at 11.09.33 AM-min\" width=\"756\" height=\"166\" \/><\/a><\/p>\n<p><span style=\"font-weight: 400;\">In this way, you\u2019ll obtain your SonarQube-generated report:<\/span><\/p>\n<p><a href=\"http:\/\/abstracta.us\/wp-content\/uploads\/2018\/01\/Screen-Shot-2018-01-20-at-11.10.42-AM-min-1.png\"><img decoding=\"async\" class=\"aligncenter wp-image-9672 size-full\" src=\"http:\/\/abstracta.us\/wp-content\/uploads\/2018\/01\/Screen-Shot-2018-01-20-at-11.10.42-AM-min-1.png\" alt=\"sonarqube report\" width=\"771\" height=\"398\" \/><\/a><\/p>\n<h2><span class=\"ez-toc-section\" id=\"Running_the_Analysis_in_an_IDE\"><\/span><strong><span style=\"color: #00b674;\">Running the Analysis\u00a0in an IDE<\/span><\/strong><span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p><span style=\"font-weight: 400;\">This other method will allow you to execute the analysis directly from the IDE of your preference. Particularly here we will show you the use of the <\/span><a href=\"https:\/\/www.sonarlint.org\/\" target=\"_blank\" rel=\"noopener noreferrer\"><span style=\"font-weight: 400;\">SonarLint<\/span><\/a><span style=\"font-weight: 400;\"> plugin for IntelliJ, but it\u2019s equivalent for other development environments such as Eclipse or Visual Studio.<\/span><\/p>\n<h3><span class=\"ez-toc-section\" id=\"SonarLint_in_IntelliJ\"><\/span>SonarLint in IntelliJ<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p><span style=\"font-weight: 400;\">The first thing is to download the SonarLint plugin from the IntelliJ plugin manager. Once installed, proceed with the configuration.<\/span><\/p>\n<p><a href=\"http:\/\/abstracta.us\/wp-content\/uploads\/2018\/01\/2.-Configuration-1.png\"><img decoding=\"async\" class=\"aligncenter size-full wp-image-9675\" src=\"http:\/\/abstracta.us\/wp-content\/uploads\/2018\/01\/2.-Configuration-1.png\" alt=\"2. Configuration (1)\" width=\"560\" height=\"315\" \/><\/a><\/p>\n<p><span style=\"font-weight: 400;\">Select &#8220;Enable binding to remote SonarQube server&#8221; and then select &#8220;Configure servers&#8221;.<\/span><\/p>\n<p><a href=\"http:\/\/abstracta.us\/wp-content\/uploads\/2018\/01\/sonarling2-min.png\"><img decoding=\"async\" class=\"aligncenter size-full wp-image-9676\" src=\"http:\/\/abstracta.us\/wp-content\/uploads\/2018\/01\/sonarling2-min.png\" alt=\"sonarling2-min\" width=\"601\" height=\"564\" \/><\/a><\/p>\n<p><span style=\"font-weight: 400;\">Then add a server, entering the IP and the port of the server:<\/span><\/p>\n<p><a href=\"http:\/\/abstracta.us\/wp-content\/uploads\/2018\/01\/sonarlint3-768x354-min.png\"><img decoding=\"async\" class=\"aligncenter size-full wp-image-9677\" src=\"http:\/\/abstracta.us\/wp-content\/uploads\/2018\/01\/sonarlint3-768x354-min.png\" alt=\"sonarlint3-768x354-min\" width=\"768\" height=\"354\" \/><\/a><\/p>\n<p><span style=\"font-weight: 400;\">Select authentication through username and password, entering the corresponding credentials. After advancing in the wizard, choose some of the existing projects in the SonarQube server to link it.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">At this time you can proceed to analyze the project you want:<\/span><\/p>\n<p><a href=\"http:\/\/abstracta.us\/wp-content\/uploads\/2018\/01\/ejecutar-sonarlint-768x483.png\"><img decoding=\"async\" class=\"aligncenter size-full wp-image-9678\" src=\"http:\/\/abstracta.us\/wp-content\/uploads\/2018\/01\/ejecutar-sonarlint-768x483.png\" alt=\"ejecutar-sonarlint-768x483\" width=\"768\" height=\"483\" \/><\/a><\/p>\n<p><span style=\"font-weight: 400;\">Obtaining a result as shown below:<\/span><\/p>\n<p><a href=\"http:\/\/abstracta.us\/wp-content\/uploads\/2018\/01\/resultado-sonarlint-768x200-1-min.png\"><img decoding=\"async\" class=\"aligncenter size-full wp-image-9679\" src=\"http:\/\/abstracta.us\/wp-content\/uploads\/2018\/01\/resultado-sonarlint-768x200-1-min.png\" alt=\"resultado-sonarlint-768x200-1-min\" width=\"768\" height=\"200\" \/><\/a><\/p>\n<p><span style=\"font-weight: 400;\">After executing the analysis, you can go to your code and SonarLint will mark the errors or possible corrections to be made as if it were a syntax error marked by the IDE itself.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">What a surprise it is to see all the failures that SonarQube reports, no!? You can learn a lot by incorporating this tool early in a project. What do you think?<\/span><\/p>\n<hr \/>\n<h2><span class=\"ez-toc-section\" id=\"Recommended_for_You\"><\/span><strong>Recommended for You<\/strong><span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p><a href=\"http:\/\/abstracta.us\/blog\/software-testing\/code-analysis-part-1-know-technical-debt\/\">Code Analysis Part 1: What You Should Know About Technical Debt<\/a><br \/>\n<a href=\"http:\/\/abstracta.us\/blog\/software-testing\/code-analysis-part-2-analyzing-code-sonarqube\/\"><span style=\"font-weight: 400;\">Code Analysis Part 2: Analyzing Code with SonarQube<\/span><\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>How to run a code analysis from Maven or an IDE In part two of this blog series on code analysis, I showed you how to do a proof of concept quickly using a SonarQube Docker image, and run the analysis from SonarQube Scanner. In&#8230;<\/p>\n","protected":false},"author":18,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1,61],"tags":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v14.0.2 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Code Analysis: SonarQube Alternatives | Abstracta<\/title>\n<meta name=\"description\" content=\"Looking for SonarQube alternatives to run your code analysis? We&#039;ll show you how to use Maven and SonarLint in part 3 of our code analysis series.\" \/>\n<meta name=\"robots\" content=\"index, follow\" \/>\n<meta name=\"googlebot\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<meta name=\"bingbot\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/abstracta.us\/blog\/testing-tools\/code-analysis-part-3-sonarqube-alternatives\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Code Analysis: SonarQube Alternatives | Abstracta\" \/>\n<meta property=\"og:description\" content=\"Looking for SonarQube alternatives to run your code analysis? We&#039;ll show you how to use Maven and SonarLint in part 3 of our code analysis series.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/abstracta.us\/blog\/testing-tools\/code-analysis-part-3-sonarqube-alternatives\/\" \/>\n<meta property=\"og:site_name\" content=\"Blog about AI-powered quality engineering for teams building complex software | Abstracta\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/AbstractaQA\/\" \/>\n<meta property=\"article:published_time\" content=\"2018-01-20T19:55:50+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2025-05-05T21:20:37+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/abstracta.us\/wp-content\/uploads\/2018\/01\/SONARQUBE-Alternatives.png\" \/>\n\t<meta property=\"og:image:width\" content=\"560\" \/>\n\t<meta property=\"og:image:height\" content=\"315\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@AbstractaUS\" \/>\n<meta name=\"twitter:site\" content=\"@AbstractaUS\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebSite\",\"@id\":\"https:\/\/abstracta.us\/blog\/#website\",\"url\":\"https:\/\/abstracta.us\/blog\/\",\"name\":\"Blog about AI-powered quality engineering for teams building complex software | Abstracta\",\"description\":\"AI-powered quality engineering\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":\"https:\/\/abstracta.us\/blog\/?s={search_term_string}\",\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"en-US\"},{\"@type\":\"ImageObject\",\"@id\":\"https:\/\/abstracta.us\/blog\/testing-tools\/code-analysis-part-3-sonarqube-alternatives\/#primaryimage\",\"inLanguage\":\"en-US\",\"url\":\"http:\/\/abstracta.us\/wp-content\/uploads\/2018\/01\/Screen-Shot-2018-01-20-at-11.06.59-AM-min.png\"},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/abstracta.us\/blog\/testing-tools\/code-analysis-part-3-sonarqube-alternatives\/#webpage\",\"url\":\"https:\/\/abstracta.us\/blog\/testing-tools\/code-analysis-part-3-sonarqube-alternatives\/\",\"name\":\"Code Analysis: SonarQube Alternatives | Abstracta\",\"isPartOf\":{\"@id\":\"https:\/\/abstracta.us\/blog\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/abstracta.us\/blog\/testing-tools\/code-analysis-part-3-sonarqube-alternatives\/#primaryimage\"},\"datePublished\":\"2018-01-20T19:55:50+00:00\",\"dateModified\":\"2025-05-05T21:20:37+00:00\",\"author\":{\"@id\":\"https:\/\/abstracta.us\/blog\/#\/schema\/person\/c68426aae266fb10c7db3f3d6af2a321\"},\"description\":\"Looking for SonarQube alternatives to run your code analysis? We'll show you how to use Maven and SonarLint in part 3 of our code analysis series.\",\"breadcrumb\":{\"@id\":\"https:\/\/abstracta.us\/blog\/testing-tools\/code-analysis-part-3-sonarqube-alternatives\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/abstracta.us\/blog\/testing-tools\/code-analysis-part-3-sonarqube-alternatives\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/abstracta.us\/blog\/testing-tools\/code-analysis-part-3-sonarqube-alternatives\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"item\":{\"@type\":\"WebPage\",\"@id\":\"https:\/\/abstracta.us\/blog\/\",\"url\":\"https:\/\/abstracta.us\/blog\/\",\"name\":\"Home\"}},{\"@type\":\"ListItem\",\"position\":2,\"item\":{\"@type\":\"WebPage\",\"@id\":\"https:\/\/abstracta.us\/blog\/testing-tools\/\",\"url\":\"https:\/\/abstracta.us\/blog\/testing-tools\/\",\"name\":\"Testing Tools\"}},{\"@type\":\"ListItem\",\"position\":3,\"item\":{\"@type\":\"WebPage\",\"@id\":\"https:\/\/abstracta.us\/blog\/testing-tools\/code-analysis-part-3-sonarqube-alternatives\/\",\"url\":\"https:\/\/abstracta.us\/blog\/testing-tools\/code-analysis-part-3-sonarqube-alternatives\/\",\"name\":\"Code Analysis Part 3: SonarQube Alternatives\"}}]},{\"@type\":[\"Person\"],\"@id\":\"https:\/\/abstracta.us\/blog\/#\/schema\/person\/c68426aae266fb10c7db3f3d6af2a321\",\"name\":\"Mat\\u00edas Fornara, Operation Manager at Abstracta\",\"image\":{\"@type\":\"ImageObject\",\"@id\":\"https:\/\/abstracta.us\/blog\/#personlogo\",\"inLanguage\":\"en-US\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/e3720307097a99a3775478ad6bd51352?s=96&d=blank&r=g\",\"caption\":\"Mat\\u00edas Fornara, Operation Manager at Abstracta\"},\"description\":\"Tech Lead &amp; Performance Engineer, Abstracta\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","_links":{"self":[{"href":"https:\/\/abstracta.us\/blog\/wp-json\/wp\/v2\/posts\/9668"}],"collection":[{"href":"https:\/\/abstracta.us\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/abstracta.us\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/abstracta.us\/blog\/wp-json\/wp\/v2\/users\/18"}],"replies":[{"embeddable":true,"href":"https:\/\/abstracta.us\/blog\/wp-json\/wp\/v2\/comments?post=9668"}],"version-history":[{"count":7,"href":"https:\/\/abstracta.us\/blog\/wp-json\/wp\/v2\/posts\/9668\/revisions"}],"predecessor-version":[{"id":12646,"href":"https:\/\/abstracta.us\/blog\/wp-json\/wp\/v2\/posts\/9668\/revisions\/12646"}],"wp:attachment":[{"href":"https:\/\/abstracta.us\/blog\/wp-json\/wp\/v2\/media?parent=9668"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/abstracta.us\/blog\/wp-json\/wp\/v2\/categories?post=9668"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/abstracta.us\/blog\/wp-json\/wp\/v2\/tags?post=9668"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}