Download sonarcube and sonar-scanner.
Extract both zip files to to C:\At
C:\sonar-scanner\conf\sonar-scanner.properties
paste this:
#Configure here general information about the environment, such as SonarQube server connection details for example
#No information about specific project should appear here
#----- Default SonarQube server
sonar.host.url=http://localhost:9000
#----- Default source code encoding
sonar.sourceEncoding=UTF-8
- Add window environment variables
ControlPanel > SystemAndSecurity > System > AdvanceSystemSettings > Environment > EnvironmentVariables
add new path:
C:\sonar-scanner\bin
- Create a sonarqube project
In your browser go to:
http://localhost:9000/
Create a project, then save the generated token and the generated command. We will need the command to run the project later.
- On your code, create file called
sonar-project.properties
, paste this:
# must be unique in a given SonarQube instance
sonar.projectKey=my:project
# --- optional properties ---
# defaults to project key
# sonar.projectName=My project
# defaults to 'not provided'
#sonar.projectVersion=1.0
# Path is relative to the sonar-project.properties file. Defaults to .
sonar.sources=.
# Encoding of the source code. Default is default system encoding
#sonar.sourceEncoding=UTF-8
Change projectKey same with the name of created sonarqube project.
- Run the sonarqube
Run C:\sonarqube\bin\windows-x86-64\StartSonar.bat
Paste the saved generated command inside your project to run the sonarqube.
Go back to http://localhost:9000
Now you can see the vulnerabilities and given suggestion by sonarqube.
Top comments (0)