{"id":368,"date":"2018-02-24T17:27:34","date_gmt":"2018-02-24T17:27:34","guid":{"rendered":"http:\/\/kevinmichaelcoy.com\/blog\/?p=368"},"modified":"2018-02-24T18:07:30","modified_gmt":"2018-02-24T18:07:30","slug":"code-analysis-with-java-and-angularjs-project-via-sonarqube","status":"publish","type":"post","link":"http:\/\/kevinmichaelcoy.com\/blog\/2018\/02\/24\/code-analysis-with-java-and-angularjs-project-via-sonarqube\/","title":{"rendered":"Code Analysis with Java and AngularJS Project via SonarQube"},"content":{"rendered":"<div id=\"attachment_417\" style=\"width: 2124px\" class=\"wp-caption aligncenter\"><img aria-describedby=\"caption-attachment-417\" loading=\"lazy\" class=\"size-full wp-image-417\" src=\"http:\/\/kevinmichaelcoy.com\/blog\/wp-content\/uploads\/2018\/02\/Code-Analysis-with-Java-and-AngularJS-Project-via-SonarQube-blog.png\" alt=\"Code Analysis with Java and AngularJS Project via SonarQube\" width=\"2114\" height=\"1196\" \/><p id=\"caption-attachment-417\" class=\"wp-caption-text\">Code Analysis with Java and AngularJS Project via SonarQube<\/p><\/div>\n<p>Many Java based projects are shifting away from more traditional Java based frontend technologies, such as JSP, JSF, and GWT. Today, they are moving to Single Page Application technologies like AngularJS. This leaves Java as the language for the backend. As a result, you will likely experience a project using at least a JavaScript based frontend technology and a backend technology like Java. Another big trend these days is improving the software development lifecycle by implementing Continuous Integration, Continuous Deployment, and code analysis as a part of your project or company&#8217;s DevOps strategy. This tutorial will show you how to tie a project built using Java and AngularJS with Jenkins, BitBucket and SonarQube.<\/p>\n<p>If you are using Maven and the concept of microservices, you likely are following a <a href=\"https:\/\/maven.apache.org\/guides\/introduction\/introduction-to-the-standard-directory-layout.html\">standard directory structure<\/a> used for many Java projects. Also, if you have a web application, you are likely used to using a <code>webapp<\/code> folder for your presentation code, perhaps written with JSPs or JSFs. With that assumption, if you were switching to a JavaScript based frontend framework, like AngularJS, then you may have also put your JavaScript files in this very same <code>webapp<\/code> folder. Lets say we have two services and one project for the web application, then you may have a Git repo that looks like the following:<\/p>\n<div id=\"attachment_382\" style=\"width: 1544px\" class=\"wp-caption aligncenter\"><img aria-describedby=\"caption-attachment-382\" loading=\"lazy\" class=\"size-full wp-image-382\" src=\"http:\/\/kevinmichaelcoy.com\/blog\/wp-content\/uploads\/2018\/02\/java-project-directory-structure-maven.png\" alt=\"Microservices Maven Java Standard Directory Structure\" width=\"1534\" height=\"784\" srcset=\"http:\/\/kevinmichaelcoy.com\/blog\/wp-content\/uploads\/2018\/02\/java-project-directory-structure-maven.png 1534w, http:\/\/kevinmichaelcoy.com\/blog\/wp-content\/uploads\/2018\/02\/java-project-directory-structure-maven-300x153.png 300w, http:\/\/kevinmichaelcoy.com\/blog\/wp-content\/uploads\/2018\/02\/java-project-directory-structure-maven-768x393.png 768w, http:\/\/kevinmichaelcoy.com\/blog\/wp-content\/uploads\/2018\/02\/java-project-directory-structure-maven-1024x523.png 1024w, http:\/\/kevinmichaelcoy.com\/blog\/wp-content\/uploads\/2018\/02\/java-project-directory-structure-maven-150x77.png 150w\" sizes=\"(max-width: 1534px) 100vw, 1534px\" \/><p id=\"caption-attachment-382\" class=\"wp-caption-text\">Microservices Maven Java Standard Directory Structure<\/p><\/div>\n<p>The <code>dvo-web-ui<\/code> is the web application project. You likely wouldn&#8217;t have any Java code mixed in this project, but you may have some Selenium tests (though maybe not the best testing tool for AngularJS). The Java code would be in the two microservices, called <code>dvo-claim-service<\/code> and <code>dvo-product-service<\/code>.<\/p>\n<p>If you don&#8217;t already have Tomcat installed, you can download the latest here:<\/p>\n<ul>\n<li><a href=\"https:\/\/tomcat.apache.org\">https:\/\/tomcat.apache.org<\/a> or, more specifically I am using <a href=\"http:\/\/mirror.jax.hugeserver.com\/apache\/tomcat\/tomcat-9\/v9.0.5\/bin\/apache-tomcat-9.0.5.zip\">Tomcat 9.0.5<\/a><\/li>\n<\/ul>\n<p>Now, find your downloaded file, <code>apache-tomcat-9.0.5.zip<\/code>, and then unzip the file. \u00a0If using a Mac\/Unix build, you will likely need to make the scripts in <code>bin<\/code> executable by doing the following:<\/p>\n<p>[code language=&#8221;bash&#8221;]<br \/>\n$ chmod 755 bin\/*.sh<br \/>\n$ ls -ltr bin\/*.sh<br \/>\n-rwxr-xr-x@ 1 kcoy  staff   1908 Feb  6 21:43 bin\/version.sh<br \/>\n-rwxr-xr-x@ 1 kcoy  staff   5483 Feb  6 21:43 bin\/tool-wrapper.sh<br \/>\n-rwxr-xr-x@ 1 kcoy  staff   1904 Feb  6 21:43 bin\/startup.sh<br \/>\n-rwxr-xr-x@ 1 kcoy  staff   1902 Feb  6 21:43 bin\/shutdown.sh<br \/>\n-rwxr-xr-x@ 1 kcoy  staff   3680 Feb  6 21:43 bin\/setclasspath.sh<br \/>\n-rwxr-xr-x@ 1 kcoy  staff   1965 Feb  6 21:43 bin\/digest.sh<br \/>\n-rwxr-xr-x@ 1 kcoy  staff   8509 Feb  6 21:43 bin\/daemon.sh<br \/>\n-rwxr-xr-x@ 1 kcoy  staff   1922 Feb  6 21:43 bin\/configtest.sh<br \/>\n-rwxr-xr-x@ 1 kcoy  staff   1997 Feb  6 21:43 bin\/ciphers.sh<br \/>\n-rwxr-xr-x@ 1 kcoy  staff  23315 Feb  6 21:43 bin\/catalina.sh<br \/>\n[\/code]<\/p>\n<p>Next, you will need to download the Jenkins WAR:<\/p>\n<ul>\n<li><a href=\"https:\/\/jenkins.io\/download\/\">https:\/\/jenkins.io\/download\/<\/a><\/li>\n<\/ul>\n<p>I would go for the Long-Term Support (LTS) build, which is currently, 2.89.4<\/p>\n<ul>\n<li><a href=\"http:\/\/mirrors.jenkins.io\/war-stable\/latest\/jenkins.war\">\u00a0 Generic Java package (.war)\u00a0<\/a><\/li>\n<\/ul>\n<p>Take <code>jenkins.war<\/code> and move it your webapps folder in the Tomcat directory you just unzipped.<\/p>\n<p>[code language=&#8221;bash&#8221;]<br \/>\n$ .\/bin\/startup.sh<br \/>\nUsing CATALINA_BASE:   \/Applications\/apache-tomcat-9.0.5<br \/>\nUsing CATALINA_HOME:   \/Applications\/apache-tomcat-9.0.5<br \/>\nUsing CATALINA_TMPDIR: \/Applications\/apache-tomcat-9.0.5\/temp<br \/>\nUsing JRE_HOME:        \/Library\/Java\/JavaVirtualMachines\/jdk1.8.0_121.jdk\/Contents\/Home<br \/>\nUsing CLASSPATH:       \/Applications\/apache-tomcat-9.0.5\/bin\/bootstrap.jar:\/Applications\/apache-tomcat-9.0.5\/bin\/tomcat-juli.jar<br \/>\nTomcat started.<br \/>\n[\/code]<\/p>\n<p>You should be able to now go to the following link (you&#8217;ll need to follow the <a href=\"https:\/\/jenkins.io\/doc\/book\/installing\/#setup-wizard\">setup instructions<\/a> if this is your first time launching Jenkins):<\/p>\n<ul>\n<li><a href=\"http:\/\/localhost:8080\/jenkins\">http:\/\/localhost:8080\/jenkins<\/a><\/li>\n<\/ul>\n<p>Afterwards, you&#8217;ll need to install the SonarQube plugin by going to Manage Jenkins ? Manage Plugins ? Available tab ? Filter &#8220;SonarQube&#8221; ? Select SonarQube Scanner ? Install without restart ? Check Restart Jenkins.<\/p>\n<div id=\"attachment_390\" style=\"width: 2480px\" class=\"wp-caption aligncenter\"><img aria-describedby=\"caption-attachment-390\" loading=\"lazy\" class=\"size-full wp-image-390\" src=\"http:\/\/kevinmichaelcoy.com\/blog\/wp-content\/uploads\/2018\/02\/jenkins-install-sonarqube-scanner-plugin.png\" alt=\"Installing SonarQube Scanner Plugin for Jenkins\" width=\"2470\" height=\"1448\" srcset=\"http:\/\/kevinmichaelcoy.com\/blog\/wp-content\/uploads\/2018\/02\/jenkins-install-sonarqube-scanner-plugin.png 2470w, http:\/\/kevinmichaelcoy.com\/blog\/wp-content\/uploads\/2018\/02\/jenkins-install-sonarqube-scanner-plugin-300x176.png 300w, http:\/\/kevinmichaelcoy.com\/blog\/wp-content\/uploads\/2018\/02\/jenkins-install-sonarqube-scanner-plugin-768x450.png 768w, http:\/\/kevinmichaelcoy.com\/blog\/wp-content\/uploads\/2018\/02\/jenkins-install-sonarqube-scanner-plugin-1024x600.png 1024w, http:\/\/kevinmichaelcoy.com\/blog\/wp-content\/uploads\/2018\/02\/jenkins-install-sonarqube-scanner-plugin-150x88.png 150w\" sizes=\"(max-width: 2470px) 100vw, 2470px\" \/><p id=\"caption-attachment-390\" class=\"wp-caption-text\">Installing SonarQube Scanner Plugin for Jenkins<\/p><\/div>\n<p>I like to use BitBucket for source control as it comes with lots of nice features, such as a wiki, managers users\/teams and is FREE for five or less users, If you are using BitBucket, you&#8217;ll need to install the BitBucket plugin, as well, by going to Manage Jenkins ? Manage Plugins ? Available tab ? Filter &#8220;BitBucket&#8221; ? Select BitBucket ? Install without restart ? Check Restart Jenkins.<\/p>\n<p>Also, in BitBucket, you&#8217;ll need to setup a WebHook, which can be used to trigger a Jenkins build (with the BitBucket plugin) every time a code push is made to your Git repository hosted by BitBucket. As an aside, BitBucket is hosted on the cloud and if your Tomcat is being being hosted locally on your computer, then you&#8217;ll need to expose your localhost to the outside world. An easy way to do this is with <code>ngrok<\/code>. See these <a href=\"http:\/\/kevinmichaelcoy.com\/blog\/2018\/02\/24\/how-to-point-bitbucket-webhook-to-jenkins-on-localhost\/\">instructions<\/a>. Here is a screenshot showing how to configure the webhook under Settings in your BitBucket project.<\/p>\n<div id=\"attachment_395\" style=\"width: 2040px\" class=\"wp-caption aligncenter\"><img aria-describedby=\"caption-attachment-395\" loading=\"lazy\" class=\"size-full wp-image-395\" src=\"http:\/\/kevinmichaelcoy.com\/blog\/wp-content\/uploads\/2018\/02\/BitBucket-Jenkins-Webhook-settings.png\" alt=\"Jenkins BitBucket webhook\" width=\"2030\" height=\"746\" srcset=\"http:\/\/kevinmichaelcoy.com\/blog\/wp-content\/uploads\/2018\/02\/BitBucket-Jenkins-Webhook-settings.png 2030w, http:\/\/kevinmichaelcoy.com\/blog\/wp-content\/uploads\/2018\/02\/BitBucket-Jenkins-Webhook-settings-300x110.png 300w, http:\/\/kevinmichaelcoy.com\/blog\/wp-content\/uploads\/2018\/02\/BitBucket-Jenkins-Webhook-settings-768x282.png 768w, http:\/\/kevinmichaelcoy.com\/blog\/wp-content\/uploads\/2018\/02\/BitBucket-Jenkins-Webhook-settings-1024x376.png 1024w, http:\/\/kevinmichaelcoy.com\/blog\/wp-content\/uploads\/2018\/02\/BitBucket-Jenkins-Webhook-settings-150x55.png 150w\" sizes=\"(max-width: 2030px) 100vw, 2030px\" \/><p id=\"caption-attachment-395\" class=\"wp-caption-text\">Jenkins BitBucket webhook<\/p><\/div>\n<p>Now you will need to make sure you have the SonarQube Scanner configured in Jenkins and have your project set up to use it. You&#8217;ll need to make sure you go to Jenkins ? Manage Jenkins ? Global Tool Configuration to configure a SonarQube Scanner to use and go to Jenkins ? Manage Jenkins ? Configure System to point to your SonarQube instance you downloaded previously. Make sure you have your SonarQube instance running:<\/p>\n<p>[code language=&#8221;bash&#8221;]<br \/>\nsonarqube-5.6.5 kcoy$ .\/bin\/macosx-universal-64\/sonar.sh start<br \/>\n[\/code]<\/p>\n<p style=\"text-align: left;\">Here are some screenshots showing how to configure SonarQube in Jenkins and how to configure a project to use your SonarQube Scanner.<\/p>\n\n\t\t<style type=\"text\/css\">\n\t\t\t#gallery-1 {\n\t\t\t\tmargin: auto;\n\t\t\t}\n\t\t\t#gallery-1 .gallery-item {\n\t\t\t\tfloat: left;\n\t\t\t\tmargin-top: 10px;\n\t\t\t\ttext-align: center;\n\t\t\t\twidth: 50%;\n\t\t\t}\n\t\t\t#gallery-1 img {\n\t\t\t\tborder: 2px solid #cfcfcf;\n\t\t\t}\n\t\t\t#gallery-1 .gallery-caption {\n\t\t\t\tmargin-left: 0;\n\t\t\t}\n\t\t\t\/* see gallery_shortcode() in wp-includes\/media.php *\/\n\t\t<\/style>\n\t\t<div id='gallery-1' class='gallery galleryid-368 gallery-columns-2 gallery-size-medium'><dl class='gallery-item'>\n\t\t\t<dt class='gallery-icon landscape'>\n\t\t\t\t<a href='http:\/\/kevinmichaelcoy.com\/blog\/2018\/02\/24\/code-analysis-with-java-and-angularjs-project-via-sonarqube\/jenkins-configuration-sonarqube-server-2\/'><img width=\"300\" height=\"161\" src=\"http:\/\/kevinmichaelcoy.com\/blog\/wp-content\/uploads\/2018\/02\/jenkins-configuration-sonarqube-server-1-300x161.png\" class=\"attachment-medium size-medium\" alt=\"Jenkins Configuration for SonarQube server.\" loading=\"lazy\" aria-describedby=\"gallery-1-409\" srcset=\"http:\/\/kevinmichaelcoy.com\/blog\/wp-content\/uploads\/2018\/02\/jenkins-configuration-sonarqube-server-1-300x161.png 300w, http:\/\/kevinmichaelcoy.com\/blog\/wp-content\/uploads\/2018\/02\/jenkins-configuration-sonarqube-server-1-768x413.png 768w, http:\/\/kevinmichaelcoy.com\/blog\/wp-content\/uploads\/2018\/02\/jenkins-configuration-sonarqube-server-1-1024x550.png 1024w, http:\/\/kevinmichaelcoy.com\/blog\/wp-content\/uploads\/2018\/02\/jenkins-configuration-sonarqube-server-1-150x81.png 150w\" sizes=\"(max-width: 300px) 100vw, 300px\" \/><\/a>\n\t\t\t<\/dt>\n\t\t\t\t<dd class='wp-caption-text gallery-caption' id='gallery-1-409'>\n\t\t\t\tJenkins Configuration for SonarQube server.\n\t\t\t\t<\/dd><\/dl><dl class='gallery-item'>\n\t\t\t<dt class='gallery-icon landscape'>\n\t\t\t\t<a href='http:\/\/kevinmichaelcoy.com\/blog\/2018\/02\/24\/code-analysis-with-java-and-angularjs-project-via-sonarqube\/jenkins-global-tool-configuration-sonarqube-scanner\/'><img width=\"300\" height=\"102\" src=\"http:\/\/kevinmichaelcoy.com\/blog\/wp-content\/uploads\/2018\/02\/jenkins-global-tool-configuration-sonarqube-scanner-300x102.png\" class=\"attachment-medium size-medium\" alt=\"Configure SonarQube Scanner in Jenkins Global Tool Configuration\" loading=\"lazy\" aria-describedby=\"gallery-1-410\" srcset=\"http:\/\/kevinmichaelcoy.com\/blog\/wp-content\/uploads\/2018\/02\/jenkins-global-tool-configuration-sonarqube-scanner-300x102.png 300w, http:\/\/kevinmichaelcoy.com\/blog\/wp-content\/uploads\/2018\/02\/jenkins-global-tool-configuration-sonarqube-scanner-768x262.png 768w, http:\/\/kevinmichaelcoy.com\/blog\/wp-content\/uploads\/2018\/02\/jenkins-global-tool-configuration-sonarqube-scanner-1024x349.png 1024w, http:\/\/kevinmichaelcoy.com\/blog\/wp-content\/uploads\/2018\/02\/jenkins-global-tool-configuration-sonarqube-scanner-150x51.png 150w\" sizes=\"(max-width: 300px) 100vw, 300px\" \/><\/a>\n\t\t\t<\/dt>\n\t\t\t\t<dd class='wp-caption-text gallery-caption' id='gallery-1-410'>\n\t\t\t\tConfigure SonarQube Scanner in Jenkins Global Tool Configuration\n\t\t\t\t<\/dd><\/dl><br style=\"clear: both\" \/><dl class='gallery-item'>\n\t\t\t<dt class='gallery-icon landscape'>\n\t\t\t\t<a href='http:\/\/kevinmichaelcoy.com\/blog\/2018\/02\/24\/code-analysis-with-java-and-angularjs-project-via-sonarqube\/jenkins-project-config-source-code-management\/'><img width=\"300\" height=\"191\" src=\"http:\/\/kevinmichaelcoy.com\/blog\/wp-content\/uploads\/2018\/02\/jenkins-project-config-source-code-management-300x191.png\" class=\"attachment-medium size-medium\" alt=\"Configure Jenkins Project to do point to BitBucket for your repository.\" loading=\"lazy\" aria-describedby=\"gallery-1-412\" srcset=\"http:\/\/kevinmichaelcoy.com\/blog\/wp-content\/uploads\/2018\/02\/jenkins-project-config-source-code-management-300x191.png 300w, http:\/\/kevinmichaelcoy.com\/blog\/wp-content\/uploads\/2018\/02\/jenkins-project-config-source-code-management-768x488.png 768w, http:\/\/kevinmichaelcoy.com\/blog\/wp-content\/uploads\/2018\/02\/jenkins-project-config-source-code-management-1024x651.png 1024w, http:\/\/kevinmichaelcoy.com\/blog\/wp-content\/uploads\/2018\/02\/jenkins-project-config-source-code-management-150x95.png 150w, http:\/\/kevinmichaelcoy.com\/blog\/wp-content\/uploads\/2018\/02\/jenkins-project-config-source-code-management-318x201.png 318w\" sizes=\"(max-width: 300px) 100vw, 300px\" \/><\/a>\n\t\t\t<\/dt>\n\t\t\t\t<dd class='wp-caption-text gallery-caption' id='gallery-1-412'>\n\t\t\t\tConfigure Jenkins Project to do point to BitBucket for your repository.\n\t\t\t\t<\/dd><\/dl><dl class='gallery-item'>\n\t\t\t<dt class='gallery-icon landscape'>\n\t\t\t\t<a href='http:\/\/kevinmichaelcoy.com\/blog\/2018\/02\/24\/code-analysis-with-java-and-angularjs-project-via-sonarqube\/jenkins-project-config-build-and-sonarqube-scanner-2\/'><img width=\"300\" height=\"189\" src=\"http:\/\/kevinmichaelcoy.com\/blog\/wp-content\/uploads\/2018\/02\/jenkins-project-config-build-and-sonarqube-scanner-1-300x189.png\" class=\"attachment-medium size-medium\" alt=\"Configure Jenkins Project to do a build and to use the SonarQube Scanner\" loading=\"lazy\" aria-describedby=\"gallery-1-411\" srcset=\"http:\/\/kevinmichaelcoy.com\/blog\/wp-content\/uploads\/2018\/02\/jenkins-project-config-build-and-sonarqube-scanner-1-300x189.png 300w, http:\/\/kevinmichaelcoy.com\/blog\/wp-content\/uploads\/2018\/02\/jenkins-project-config-build-and-sonarqube-scanner-1-768x484.png 768w, http:\/\/kevinmichaelcoy.com\/blog\/wp-content\/uploads\/2018\/02\/jenkins-project-config-build-and-sonarqube-scanner-1-1024x646.png 1024w, http:\/\/kevinmichaelcoy.com\/blog\/wp-content\/uploads\/2018\/02\/jenkins-project-config-build-and-sonarqube-scanner-1-150x95.png 150w, http:\/\/kevinmichaelcoy.com\/blog\/wp-content\/uploads\/2018\/02\/jenkins-project-config-build-and-sonarqube-scanner-1-318x201.png 318w\" sizes=\"(max-width: 300px) 100vw, 300px\" \/><\/a>\n\t\t\t<\/dt>\n\t\t\t\t<dd class='wp-caption-text gallery-caption' id='gallery-1-411'>\n\t\t\t\tConfigure Jenkins Project to do a build and to use the SonarQube Scanner\n\t\t\t\t<\/dd><\/dl><br style=\"clear: both\" \/>\n\t\t<\/div>\n\n<p>Next, you need to make sure that your project has a <code>sonar-project.properties<\/code> file in the root of the parent project. Here is an example of this file configured for multiple modules and for scanning both Java and JavaScript code.<\/p>\n<p>[code language=&#8221;bash&#8221;]<br \/>\n#<br \/>\n# Used to configure project to work with SonarQube via Jenkins automatically<br \/>\n#<\/p>\n<p># Required metadata<br \/>\nsonar.projectKey=dvo-claim-service<br \/>\nsonar.projectName=DVO Claim Service project analyzed with the SonarQube Runner<br \/>\nsonar.projectVersion=1.0<br \/>\n#sonar.host.url=http:\/\/15.82.89.248:9000<\/p>\n<p>sonar.jdbc.username=sonar<br \/>\nsonar.jdbc.password=********<br \/>\nsonar.jdbc.url=jdbc:mysql:\/\/localhost:3306\/sonar?useUnicode=true&amp;characterEncoding=utf8&amp;rewriteBatchedStatements=true&amp;useConfigs=maxPerformance<\/p>\n<p># Comma-separated paths to directories with sources (required)<br \/>\nsonar.sources=src\/test\/java,src\/main\/java<\/p>\n<p># Language<br \/>\nsonar.language=java<\/p>\n<p># Encoding of the source files<br \/>\nsonar.sourceEncoding=UTF-8<\/p>\n<p># JUnit reports<br \/>\nsonar.junit.reportsPath=**\/target\/surefire-reports\/<\/p>\n<p># Set module IDs<br \/>\nsonar.modules=dvo-claim-service,dvo-web-ui,dvo-product-service<\/p>\n<p># Default module base directory is &lt;curent_directory&gt;\/&lt;module_ID&gt;<br \/>\n# It has to be overriden for dvo-web-ui<br \/>\ndvo-web-ui.sonar.projectBaseDir=dvo-web-ui<\/p>\n<p># Overrides some parent properties in dvo-web-ui<br \/>\ndvo-web-ui.sonar.projectName=DVO Web UI project analyzed with the SonarQube Runner<br \/>\ndvo-web-ui.sonar.sources=src\/main\/webapp<br \/>\ndvo-web-ui.sonar.language=js<\/p>\n<p># Default module base directory is &lt;curent_directory&gt;\/&lt;module_ID&gt;<br \/>\n# It has to be overriden for dvo-product-service<br \/>\ndvo-product-service.sonar.projectBaseDir=dvo-product-service<\/p>\n<p># Overrides some parent properties in dvo-product-service<br \/>\ndvo-product-service.sonar.projectName=DVO Product Service project analyzed with the SonarQube Runner<br \/>\ndvo-product-service.sonar.sources=src\/test\/java,src\/main\/java<br \/>\ndvo-product-service.sonar.language=java<br \/>\n[\/code]<\/p>\n<p>Now, so long as you have Tomcat, BitBucket, Jenkins, and SonarQube up and running, you can push a code change to your Git repository hosted by BitBucket and see it automatically kick off a build in Jenkins. If the build is successful, you will be able to see your SonarQube Scanner results. Good luck in your implementations!<\/p>\n<p><center>\n\t\t<style type=\"text\/css\">\n\t\t\t#gallery-2 {\n\t\t\t\tmargin: auto;\n\t\t\t}\n\t\t\t#gallery-2 .gallery-item {\n\t\t\t\tfloat: left;\n\t\t\t\tmargin-top: 10px;\n\t\t\t\ttext-align: center;\n\t\t\t\twidth: 50%;\n\t\t\t}\n\t\t\t#gallery-2 img {\n\t\t\t\tborder: 2px solid #cfcfcf;\n\t\t\t}\n\t\t\t#gallery-2 .gallery-caption {\n\t\t\t\tmargin-left: 0;\n\t\t\t}\n\t\t\t\/* see gallery_shortcode() in wp-includes\/media.php *\/\n\t\t<\/style>\n\t\t<div id='gallery-2' class='gallery galleryid-368 gallery-columns-2 gallery-size-medium'><dl class='gallery-item'>\n\t\t\t<dt class='gallery-icon landscape'>\n\t\t\t\t<a href='http:\/\/kevinmichaelcoy.com\/blog\/2018\/02\/24\/code-analysis-with-java-and-angularjs-project-via-sonarqube\/jenkins-project-sonarqube-link\/'><img width=\"300\" height=\"252\" src=\"http:\/\/kevinmichaelcoy.com\/blog\/wp-content\/uploads\/2018\/02\/jenkins-project-sonarqube-link-300x252.png\" class=\"attachment-medium size-medium\" alt=\"Jenkins Project with SonarQube link\" loading=\"lazy\" aria-describedby=\"gallery-2-414\" srcset=\"http:\/\/kevinmichaelcoy.com\/blog\/wp-content\/uploads\/2018\/02\/jenkins-project-sonarqube-link-300x252.png 300w, http:\/\/kevinmichaelcoy.com\/blog\/wp-content\/uploads\/2018\/02\/jenkins-project-sonarqube-link-768x646.png 768w, http:\/\/kevinmichaelcoy.com\/blog\/wp-content\/uploads\/2018\/02\/jenkins-project-sonarqube-link-1024x861.png 1024w, http:\/\/kevinmichaelcoy.com\/blog\/wp-content\/uploads\/2018\/02\/jenkins-project-sonarqube-link-150x126.png 150w, http:\/\/kevinmichaelcoy.com\/blog\/wp-content\/uploads\/2018\/02\/jenkins-project-sonarqube-link.png 1498w\" sizes=\"(max-width: 300px) 100vw, 300px\" \/><\/a>\n\t\t\t<\/dt>\n\t\t\t\t<dd class='wp-caption-text gallery-caption' id='gallery-2-414'>\n\t\t\t\tJenkins Project with SonarQube link\n\t\t\t\t<\/dd><\/dl><dl class='gallery-item'>\n\t\t\t<dt class='gallery-icon landscape'>\n\t\t\t\t<a href='http:\/\/kevinmichaelcoy.com\/blog\/2018\/02\/24\/code-analysis-with-java-and-angularjs-project-via-sonarqube\/sonarqube-scanner-project-java-and-javascript\/'><img width=\"300\" height=\"189\" src=\"http:\/\/kevinmichaelcoy.com\/blog\/wp-content\/uploads\/2018\/02\/sonarqube-scanner-project-java-and-javascript-300x189.png\" class=\"attachment-medium size-medium\" alt=\"SonarQube Project results.\" loading=\"lazy\" aria-describedby=\"gallery-2-413\" srcset=\"http:\/\/kevinmichaelcoy.com\/blog\/wp-content\/uploads\/2018\/02\/sonarqube-scanner-project-java-and-javascript-300x189.png 300w, http:\/\/kevinmichaelcoy.com\/blog\/wp-content\/uploads\/2018\/02\/sonarqube-scanner-project-java-and-javascript-768x484.png 768w, http:\/\/kevinmichaelcoy.com\/blog\/wp-content\/uploads\/2018\/02\/sonarqube-scanner-project-java-and-javascript-1024x645.png 1024w, http:\/\/kevinmichaelcoy.com\/blog\/wp-content\/uploads\/2018\/02\/sonarqube-scanner-project-java-and-javascript-150x94.png 150w, http:\/\/kevinmichaelcoy.com\/blog\/wp-content\/uploads\/2018\/02\/sonarqube-scanner-project-java-and-javascript-318x201.png 318w\" sizes=\"(max-width: 300px) 100vw, 300px\" \/><\/a>\n\t\t\t<\/dt>\n\t\t\t\t<dd class='wp-caption-text gallery-caption' id='gallery-2-413'>\n\t\t\t\tSonarQube Project results.\n\t\t\t\t<\/dd><\/dl><br style=\"clear: both\" \/>\n\t\t<\/div>\n<\/p>\n<p>&nbsp;<\/p>\n<p><\/center><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Many Java based projects are shifting away from more traditional Java based frontend technologies, such as JSP, JSF, and GWT. Today, they are moving to Single Page Application technologies like AngularJS. This leaves Java as the language for the backend. As a result, you will likely experience a project using&#8230;<\/p>\n<p class=\"continue-reading-button\"> <a class=\"continue-reading-link\" href=\"http:\/\/kevinmichaelcoy.com\/blog\/2018\/02\/24\/code-analysis-with-java-and-angularjs-project-via-sonarqube\/\">Continue reading<i class=\"crycon-right-dir\"><\/i><\/a><\/p>\n","protected":false},"author":1,"featured_media":419,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[5,3],"tags":[290,307,319,234,317,310,318,315,309,183,295,316,314,294,237,308],"_links":{"self":[{"href":"http:\/\/kevinmichaelcoy.com\/blog\/wp-json\/wp\/v2\/posts\/368"}],"collection":[{"href":"http:\/\/kevinmichaelcoy.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/kevinmichaelcoy.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/kevinmichaelcoy.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/kevinmichaelcoy.com\/blog\/wp-json\/wp\/v2\/comments?post=368"}],"version-history":[{"count":33,"href":"http:\/\/kevinmichaelcoy.com\/blog\/wp-json\/wp\/v2\/posts\/368\/revisions"}],"predecessor-version":[{"id":426,"href":"http:\/\/kevinmichaelcoy.com\/blog\/wp-json\/wp\/v2\/posts\/368\/revisions\/426"}],"wp:featuredmedia":[{"embeddable":true,"href":"http:\/\/kevinmichaelcoy.com\/blog\/wp-json\/wp\/v2\/media\/419"}],"wp:attachment":[{"href":"http:\/\/kevinmichaelcoy.com\/blog\/wp-json\/wp\/v2\/media?parent=368"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/kevinmichaelcoy.com\/blog\/wp-json\/wp\/v2\/categories?post=368"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/kevinmichaelcoy.com\/blog\/wp-json\/wp\/v2\/tags?post=368"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}