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 9500:9500 -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:sonar
please note
maven-sonar-plugin
doesn't takesonar-project.properties
and therefore all properties either needs to be defined inpom.xml
orcommand line argument
using-D
option. like-Dsonar.host.url=https://localhost:9500
-
if using
sonar-scanner cli command
> mvn clean install > sonar-scanner -Dproject.settings=sonar-project.properties
-