Preset conditions
The Java JDK1.8 environment is installed
Oracle 11g+ database is already installed
One, sonarqube 6.4 installation
1. Software Download Address: http://www.sonarqube.org/downloads/
2. Download Sonarqube-6.4.zip and unzip it into your folder
3. Modify configuration file Sonarqube-6.4\conf\sonar.properties
#数据库配置
sonar.jdbc.username=mydev
sonar.jdbc.password=mydev
sonar.jdbc.url=jdbc:oracle:thin:@ 127.0.0.1:1521:dbdev
#IP, port, context configuration
sonar.web.host=127.0.0.1
sonar.web.context=/sonar
sonar.web.port=8086
4. Adding Oracle Driver packages to the Sonarqube-6.4\extensions\jdbc-driver\oracle\ directory requires an Oracle 11g+ version of the driver Ojdbc6.jar.
5. Chinese Patch Download: Https://github.com/SonarQubeCommunity/sonar-l10n-zh
After downloading the source package: mvn install packaged into a jar, copied to sonarqube-6.4\extensions\plugins\
6. Enter the bin directory, select the version to start.
Local is windows-x86-64, so go to folder, select Startsonar.bat, double-click Start.
Start Successful console results
7. Browser Access http://127.0.0.1:8086/sonar/, login: admin/admin
Second, Sonarqube Scanner 3.0.3 scanner installation
1. Download Address: Https://sonarsource.bintray.com/Distribution/sonar-scanner-cli/sonar-scanner-cli-3.0.3.778-windows.zip
2. Unzip the download package and update the global settings to point to the Sonarqube server by editing sonar-scanner/conf/sonar-scanner.properties:
#-----Default sonarqube Server
Sonar.host.url=http://127.0.0.1:8086/sonar
3. Add the Sonar-scanner/bin directory to the path of the system environment variable.
4. Run cmd input command: Sonar-scanner-v Verify that the installation is correct and that the correct result is output:
Third, the use
1. Log on to the Sonarqude platform and create a new project. Go to ' Configuration > Project > Management ', and then click ' Create Project '. The only information required is the key and name of the project.
2. Project code configuration and run scan.
Create a profile in the root directory of the project: Sonar-project.properties
Sonar-project.properties configuration:
# must be unique to a given Sonarqube instance
Sonar.projectkey=projectonekey # This is the
name and version Displ Ayed in the Sonarqube UI. was mandatory prior to sonarqube 6.1.
Sonar.projectname=myprojectone
sonar.projectversion=1.0
# Path is relative to the sonar-project.properties File. Replace ' \ ' by '/' on Windows.
# This was optional if Sonar.modules is set.
Sonar.sources=src
Re-project root cmd run the following command to start profiling:
Sonar-scanner
Scan analysis Successful output
Enter Sonarqude management platform to view analysis results
For more details, see official Documentation: Https://docs.sonarqube.org/display/HOME/SonarQube+Platform