1.sonar Installation 1.1 Environmental requirements
a). Jdk
Settings for Environment variables:
Java_home=d:\program files\java\jdk1.7.0_67\
Path=%java_home%\bin;%java_home%\jre\bin
Classpath=%java_home%\lib\dt.jar;%java_home%\lib\tools.jar
1.2 Sonar Installation
As a code analysis platform, sonar mainly consists of 3 parts:
A. A database: Storing configuration information and analysis results information; (MySQL)
B. A Web server: publishing applications, online browsing, configuration analysis (sonarqube-4.5.4)
C. One client: Performing source code analysis (sonar-runner-2.4)
1.2.1 Database Installation
Sonar supports database types such as Apache Derby,h2,sql Server,mysql.orcale.postgresql and many other databases, if only testing can be done using Sonar's own H2, or Derby. They don't need any installation.
If you use a different database, you just need to create a database or table space, and provide sonar to delete the database permissions to the account. The tables and indexes will be created the first time sonar runs.
Here we are using the MySQL database. Create the following statement:
CREATE DATABASE sonar CHARACTER SET UTF8 COLLATE utf8_general_ci;
CREATE USER ' sonar ' identified by ' sonar ';
GRANT all on sonar.* to ' sonar ' @ '% ' of ' identified by ' sonar ';
GRANT all on sonar.* to ' sonar ' @ ' localhost ' identified by ' sonar ';
FLUSH privileges;
1.2.2 Installing and configuring sonar
Download the relevant application under http://www.sonarsource.org/downloads/to unzip.
1.2.2.1 Sonar Install server-side sonarqube-4.5.4
1. Configure sonarqube-4.5.4
Edit the Conf/sonar.properties file under the Sonarqube decompression package, all of the annotated database connection templates in the file are supported, just remove the comment and change it to your own database connection. Also remove the default self-attached database connection annotations.
It is generally necessary to configure the properties:
Sonar.jdbc.url: Database connection Address
Sonar.jdbc,driver: Driver class
Sonar.jdbc.user: Database user name
Sonar.jdbc.password: Password
Figure 1.1:sonarqube Database Configuration
If you use the Orcale database, place the Orcale driver package under the Sonarqube-4.5.4\extensions\jdbc-driver \oracle folder, and the driver packages for the other databases are already placed under the default path.
2. start Sonarqube
Run the Startsonar.bat file under the E:\sonar\sonarqube-4.5.4\sonarqube-4.5.4\bin\windows-x86-64 file.
Sonarqube Code Quality Management platform installation and use