Once you successfully installed the SonarQube Server in your local system, then the next step is to analyse our code with this SonarQube server and SonarQube Runner.
Now start your SonarQube Server by click on the StartSonar.bat file in the bin or start via command line. Now access the SonarQube server via browser using following URL.
Now click on the login link on the navigation menu to login using default admin credentials.
Username/Password : admin/admin
<h2> Download SonarQube Runner </h2>
Now Download the SonarQube Runner from the following link and unzip in the C:/ directory (C:sonar-runner) like this.
<h2> Download SonarQube Examples </h2>
Now download the SonarQube example from the following link, unzip and keep it in your system.
<h2> Do SonarQube Runner Configuration : </h2>
Now do the configuration change in the following file like this C:sonar-runnerconfsonar-runner.properties.
#Configure here general information about the environment, such as SonarQube DB details for example #No information about specific project should appear here #----- Default SonarQube server sonar.host.url=http://localhost:9000 #----- PostgreSQL #sonar.jdbc.url=jdbc:postgresql://localhost/sonar #----- MySQL sonar.jdbc.url=jdbc:mysql://localhost:3306/sonar?useUnicode=true&characterEncoding=utf8 #----- Oracle #sonar.jdbc.url=jdbc:oracle:thin:@localhost/XE #----- Microsoft SQLServer #sonar.jdbc.url=jdbc:jtds:sqlserver://localhost/sonar;SelectMethod=Cursor #----- Global database settings sonar.jdbc.username=sonar sonar.jdbc.password=sonar #----- Default source code encoding #sonar.sourceEncoding=UTF-8 #----- Security (when 'sonar.forceAuthentication' is set to 'true') sonar.login=admin sonar.password=admin
Create Projects Directory in SonarQube Runner Base Directory:
Please create Projects folder in SonarQube Runner Base Directory. Now create sonar-project.properties file in the Projects folder. This sonar-project.properties file will have information (like name of project, language and etc..) about the project we are going to analyse.
Now go to the SonarQube example you have download, and now copy sonar-project.properties file from following directory sonar-examples-masterprojectslanguagesphpphp-sonar-runner to Projects folder we have created in the SonarQube Runner Base Directory. Also copy the src folder from sonar-examples-masterprojectslanguagesphpphp-sonar-runner to C:sonar-runnerbin directory.
Run SonarQube Runner
Now run the SonarQube Runner service via command line. Open your command line with Administrative privilege and change the working directory to SonarQube Runner bin directory using following command.
Now type sonar-runner.bat in the command line to analyse our source code.
On the success of our analyse it will print EXECUTION SUCCESS message in command line. Now go SonarQube server dashboard, you see your analysed project name listed in Projects section. Click on the Project name, it will take you to the report page, where it lists number blocker, critical, minor and major bugs like this.
Download Premium Only Scripts & 80+ Demo scripts Instantly at just 1.95 USD per month + 10% discount to all Exclusive Scripts
If you want any of my script need to be customized according to your business requirement,
Please feel free to contact me [at] muni2explore[at]gmail.com
Note: But it will be charged based on your customization requirement