examples of sonarqube integration with simple basic maven projects
maven + sonar-maven-plugin
maven + sonar-scanner
maven + sonar-scanner
unit test coverage data + report
integration test coverage data + report
unit test + integration test combined report
maven + sonar-scanner
unit test + integration test combined coverage ratio
maven + sonar-maven-plugin
maven + sonar-scanner
maven + sonar-scanner unit test + integration test coverage ratio per module
-
local setup if not having enterprise setup
-
[OR] sonarqube server installation if not having.
- using docker
docker pull sonarqube docker run -d --name sonarqube -p 9000:9000 -p 9092:9092 sonarqube
- manual manual setup
- using docker
-
setup sonar-scanner cli (when not using
maven-sonar-plugin)brew install sonar-scanner
- Build the project, execute all the tests and analyze the project with SonarQube Scanner for Maven(from root of the project):
-
if using
maven-sonar-plugin> mvn clean verify sonar:sonarplease note
maven-sonar-plugindoesn't takesonar-project.propertiesand therefore all properties either needs to be defined inpom.xmlorcommand line argumentusing-Doption. like-Dsonar.host.url=https://localhost:9000 -
if using
sonar-scanner cli command> mvn clean install > sonar-scanner -Dproject.settings=sonar-project.properties
-