Notes:
It totally requires just 5 simple steps if you have Jenkins/Hudson running as your CI(Continuous Integration) server to install and use Sonar. Yes, 5 simple steps is all you need to get a neat and intuitive dashboard from Sonar. So, lets see what those 5 simple steps are. Step 1: Download, install and start the Sonar Server. Download the latest Sonar release from here. Unzip the distribution to your favorite location, for e.g C:\dev\projects\sonar-1.11.1. Based on your platform, run the batch file or the shell script from within the bin folder. On windows, it is C:\dev\projects\sonar-1.11.1\bin\windows-x86-32\StartSonar.bat. Open a web browser and browse to http://localhost:9000. The default login and password is admin/admin. Step 2: Install and Configure Sonar plugin on Jenkins/Hudson. Open your Jenkins/Hudson dashboard. Default is http://localhost:8080. Click on Manage Jenkins/Hudson -> Manage Plugins. Click now on the Available tab, you should see the Jenkins/Hudson Sonar Plugin. Check this plugin and click on the Install button at the far right hand corner. Restart Jenkins/Hudson and you should be able to see the plugin in the Installed tab as shown below: Next, configure the Sonar plugin from within Manage Jenkins/Hudson -> Configure System. I am using the default database, and so didn't make any changes here. However, if you are using a different database server, you need to provide the database URL, username, password and so on as shown below. Step 3: Configure your Jenkins/Hudson Job In order to activate Sonar on a project, click on Configure, and within the Post-build Actions, check Sonar and you should see the following properties. Fill those properties and Save this configuration. Step 4: Build your project Even though you don't require Maven to be used as a build tool for your project, Sonar does still require Maven to run. If Maven isn't installed, you can download and install Maven from here. Force a build on your Job on the Hudson dashboard. If Maven is installed, you should be able to see the following output in the Console Output on Hudson dashboard. Step 5: Browse to Sonar Dashboard Once the build succeeds in the last step, browse to http://localhost:8080. And you should be able to see the Sonar Dashboard as such: That's all it is to download, install, configure and get continuous quality updates from Jenkins/Hudson and Sonar. The above steps took me less than 15 minutes. I am sure many of you are already using Sonar. I haven't used it with any of my clients yet. Hopefully, will do so soon. Share your thoughts if you are using Sonar.
|
|
來自: bananarlily > 《IT》