'SonarQube - how to run the code analysis again for a project after creating that project
I have created a project and run the code analysis. Later I did some changes in rules and tried to run the code analysis again. But in the UI of http://localhost:9000/projects, I can't find any menu or button to show the instructions of running code analysis. Can anyone help?
Update on 25/02/2020
For example, I am using SonarQube for a .NET (C#) project. When I do the code analysis, as SonarQube suggested, I copied the 3 command below into command line.
SonarScanner.MSBuild.exe begin /k:"" /d:sonar.host.url=“http://localhost:9000” /d:sonar.login=""
MsBuild.exe /t:Rebuild
SonarScanner.MSBuild.exe end /d:sonar.login=""
If SonarQube can show these commands in UI of http://localhost:9000/dashboard?id=, that will be great. Otherwise, it’s hard to remember these command and the only way to run the code analysis again is to create a new project in SonarQube UI. For now, I copied these 3 commands into a .bat file after creating a project. And every time run this .bat file again after some changes in project configuration.
Solution 1:[1]
There are two important components in the ecosystem:
SonarQube:
- serves plugins and project configurations
- consumes and displays analysis results
SonarScanner
- consumes plugins and project configurations
- performs analysis and publish the results
When you change anything in the project configuration, you have to perform a new analysis to see the results. It means you have to:
run the code analysis
Solution 2:[2]
Run the code analysis again the way you did before.
Solution 3:[3]
You can simply run the following command -
mvn sonar:sonar -Dsonar.host.url=$HOST_URL
You can also provide other parameters such as login, password, project key by adding them as a system property. For example to add login password add the following -
-Dsonar.login=$USERNAME -Dsonar.password=$PASSWORD
This will run the analysis and once completed it will be available on your sonarqube dashboard.
Solution 4:[4]
maybe all he wants is a simple url
http://localhost:9000/tutorials?id=yourproject
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | agabrys |
Solution 2 | Rafael Parungao |
Solution 3 | Raj Shah |
Solution 4 | Sora |