SonarQube

SonarQube

Step 1: Download SonarQube 6.1(Oct 13, 2016) from the below link,

http://www.sonarqube.org/downloads/

Step 2: Download SonarQube Scanner 2.8 from the below link,

http://docs.sonarqube.org/display/SCAN/Analyzing+with+SonarQube+Scanner

Step 3: Create a folder Server and paste the downloaded files (Step 1 & 2) in to it.

Step 4: Go to D:\Server\sonarqube-6.1\conf, open sonar.properties file and uncomment (delete #)  the below lines and provide the MySQL username and password

sonar.jdbc.username=root

sonar.jdbc.password=password

sonar.jdbc.url=jdbc:mysql://localhost:3306/sonar?useUnicode=true&characterEncoding=utf8&rewriteBatchedStatements=true&useConfigs=maxPerformance

Step 5: Go to D:\Server\sonar-scanner-2.8\conf, open sonar-scanner.properties file and uncomment (delete #) the below lines and provide the MySQL username and password

sonar.host.url=http://localhost:9000

sonar.sourceEncoding=UTF-8

sonar.jdbc.username=root

sonar.jdbc.password=password

sonar.jdbc.url=jdbc:mysql://localhost:3306/sonar?useUnicode=true&characterEncoding=utf8

Step 6: Update the Path variables by adding the below values,

D:\Server\sonarqube-6.1\bin

D:\Server\sonar-scanner-2.8\bin

Step 7: Go to Command Prompt,

D:\>cd server

D:\Server>cd D:\Server\sonarqube-6.1\bin\windows-x86-64

D:\Server\sonarqube-6.1\bin\windows-x86-64>StartSonar.bat

Note: Do not close the command prompt

Step 8: Open Eclipse and create a new project to make the quality check. Create a new file “sonar-project.properties” directly under the Project folder.

sonar-project.properties

# must be unique in a given SonarQube instance

sonar.projectKey=PubHub200

# this is the name and version displayed in the SonarQube UI. Was mandatory prior to SonarQube 6.1.

sonar.projectName=PubHub200

sonar.projectVersion=1.0

# Path is relative to the sonar-project.properties file. Replace “\” by “/” on Windows.

# Since SonarQube 4.2, this property is optional if sonar.modules is set.

# If not set, SonarQube starts looking for source code from the directory containing

# the sonar-project.properties file.

sonar.sources=.

# Encoding of the source code. Default is default system encoding

#sonar.sourceEncoding=UTF-8

Note: D:\RevatureWS\PubHub200\sonar-project.properties

Step 9: Run the following command from the project base directory to launch the analysis: Open another Command and run the below,

D:\RevatureWS\PubHub200>sonar-scanner

Step 10: Open the browser and http://localhost:9000/

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s