Sonar Overview
Sonar is an open platform for code quality management. Through the plug-in mechanism, Sonar can integrate different test tools, code analysis tools, and continuous integration tools.
Unlike continuous integration tools such as Hudson/jenkins, Sonar does not simply display different code-checking tool results (such as FINDBUGS,PMD, etc.) directly on a Web page, but instead process the results through different plug-ins. By quantifying the changes in the quality of the code, it is easy to do code quality management for different sizes and types of projects.
In support of other tools, Sonar not only provides support for the IDE, can view the results online in Eclipse and IntelliJ idea tools, but Sonar also provides interface support for a large number of continuous integration tools that can be easily used in continuous integration Sonar 。
In addition, Sonar Plug-ins can provide support for programming languages other than Java, as well as internationalization and reporting documentation.
Installation of Sonar
Sonar is an open source project above Codehaus, using LGPL V3 software license. We can download its source code and installation package on its official website.
Its source code needs to be checked out using a distributed version control software Git (check out), as follows:
git clone git://github.com/sonarsource/sonar.git
This article mainly introduces the use of Sonar, only to the Sonar Web site to download the latest release package, this article writing the latest version of 2.11.
After downloading the zip package, extract directly to any directory, because Sonar with the Jetty 6 application Server environment, so no additional installation can be used, it is worth mentioning that Sonar also support deployment in the Apache Tomcat application server.
In a Windows environment, start the Soanr bin directory directly under Windows-x86-64\startsonar.bat.
Then access in the browser: http://localhost:9000/
Figure 1. Sonar Access Interface
The Sonar is successfully installed and started, but there are no plug-ins installed, and users are required to download and install the plug-ins they need. This section takes Quality Index Plugin as an example of how to download and install the Sonar plug-in.
First visit Sonar home Dashboard > Sonar > Documentation > Sonar Plugin Library path
Figure 2. Download of the Sonar plugin