1. SonarQube and SonarQube Runner Configuration
STEPS:
1. Download SonarQube and SonarQube Runner from:
http://www.sonarqube.org/downloads/
a. sonarqube-5.1.zip b. sonar-runner-dist-2.4.zip
2. Unzip the files to desired location, say: D:sonarqube-5.1 and D:sonar-runner-2.4
3. Seta newenvironmentvariable as SONAR_HOME.Anditsvalue shouldbe the unzipped
locationof sonar.Example, D:sonarqube-5.1
4. Seta newenvironmentvariable as SONAR_RUNNER_HOME.Andits value shouldbe the
unzipped location of sonar-runner.Example, D:sonar-runner-2.4
2. 5. AppendSonarRunner’sbinpath(%SONAR_RUNNER_HOME%bin) tothe environmentvariable
“Path”.
6. Update the global settings(databaseconnection,serverURL) byediting sonar-
runner.properties file underSonarRunner’s conf folder.
Example- D:sonar-runner-2.4confsonar-runner.properties
3. 7. Now create a database inanyof the above database serveranduncommentthe same with
properURL and uncommentthe sonar.jdbc.username andsonar.jdbc.password,also
uncommentthe DefaultSonarQube ServerURL inthe sonar-runner.propertiesfile.
Example:Create db sonarinMSSQL server
#----- MicrosoftSQLServer
sonar.jdbc.url=jdbc:jtds:sqlserver://localhost:1433/sonar;SelectMethod=Cursor
#----- DefaultSonarQubeserver
sonar.host.url=http://localhost:9000
#----- Global database settings
sonar.jdbc.username=sa
sonar.jdbc.password=sa123
8. Update the global settings(databaseconnection,serverURL) byediting sonar.propertiesfile
undersonarqube’s conf folder.
Example:
sonar.jdbc.username=sa
sonar.jdbc.password=Password1
#----- MicrosoftSQLServer2008/2012
sonar.jdbc.url=jdbc:jtds:sqlserver://localhost:1433/sonar;SelectMethod=Cursor
9. In SONAR_HOMEbin folder,subfoldersappropriate tothe OperatingSystemwill be available
and theywill inturncontainthe SonarQube serverstartupscripts. Startthe SonarQube server
by StartSonar.bat or as service byexecuting
a) InstallNTService.bat b) StartNTService.bat
EXAMPLE: D:sonarqube-5.1binwindows-x86-64StartSonar.bat
4. Afterthe serverstarts,accessthe webinterface of the SonarQube at http://localhost:9000/
Defaultcredentialsis admin/admin
10. Nownavigate toprojectroot directorywhichyouwantto analyze.A sonar-project.properties
file hasto be placedintothe root of the projectfolder.
5. Minimumcontentof the sonar-project.propertiesfilewill be asfollows.
Sample sonar-project.propertiesfile
11. Go to commandline andchange directory(cd) to the project’srootdirectory andrun the
command
[Path of sonar-runner]binsonar-runner.bat
Example:D:sonar-runner-2.4binsonar-runner.bat
12. Upon successful executionof the above command,checkthe SonarQube dashboardbyopening
SonarQube Server’sadminpage athttp://localhost:9000(defaultURL).
Defaultcredentials –admin/admin
13. The projectwill be listedonthe dashboardwiththe name givenin sonar-project.properties file.
14. Clickon the projectname andexplore furthertoview the code analysisreport.