Sonar Server Setup
- Download the Sonar Server from http://www.sonarqube.org/downloads/
- Download and Install MySQL Server and MySQL Workbench.
- Go to MySQL Workbench and create a new Schema and name it 'sonar'.
- Update the sonar.properties @location to <sonar server location>\conf.
- Comment the embedded database and uncomment the following line to use MySQL.
- sonar.jdbc.url: jdbc:mysql://localhost:3306/sonar?useUnicode=true&characterEncoding=utf8&rewriteBatchedStatements=true
- Comment out jdbc.url: jdbc:h2:tcp://localhost:9092/sonar.
- Set sonar.jdbc.username with value 'root' and sonar.jdbc.password as empty.
- Go to <sonar server location>\bin and locate the folder as per your operating system.
- Run StartSonar.bat from the folder.
- Verify that your Server is up and running. http://localhost:9000(Default Port)
Sonar Runner Setup
- Download the Sonar Runner from http://www.sonarqube.org/downloads/
- Update the sonar.runner.properties @location to <sonar runner location>\conf.sonar.jdbc.url=jdbc:mysql://localhost:3306/sonar?useUnicode=true&characterEncoding=utf8&rewriteBatchedStatements=true
Add Project to SONAR
- Create a sonar-project.properties file with the following properties
- sonar.projectKey='YourProjectKey'(without quotes)
- sonar.projectName='YourProjectName'(without quotes)
- sonar.projectVersion=5.0
- sonar.projectDescription='Project Description'(without quotes)
- sonar.sources=(Path to the source code folder of your project)
- sonar.language=java
- sonar.sourceEncoding=UTF-8
- Save the above created properties file to your project folder.
- Add the following path in environment variables
- <SonarRunnerLocation>/bin
- Open CMD, navigate to your project folder where the above created properties file is placed and run sonar-runner command. This will run reports and upon successful execution, the sonar report can be viewed on the browser (http://localhost:9000)
No comments:
Post a Comment