- We've a jenkins job http://ec2-52-17-13-23.eu-west-1.compute.amazonaws.com:9090/job/sonarqube/ which runs sonarqube as docker container:
docker run -d --name sonarqube -p 9000:9000 -p 9092:9092 sonarqube - This jenkins job starts a new sonar server in docker container. Default admin login details are username:admin, password:admin
Hubert is changing the password for admin user for security purpose. - If we want to enable sonar code coverage to be available on this sonar server for a project:
In a project's jenkins configure section Build → Goals and options:
clean package org.jacoco:jacoco-maven-plugin:prepare-agent install -Pcoverage-per-test -Dsonar.host.url=http://ec2-52-17-13-23.eu-west-1.compute.amazonaws.com:9000 sonar:sonar
Ex: http://ec2-52-17-13-23.eu-west-1.compute.amazonaws.com:9090/job/hee-tis/configure - This will run the maven build with jacoco code covergage tool and it's reports will be integrated into sonar server.
- After the build you can view the sonar code quality metrics here for all projects:
http://ec2-52-17-13-23.eu-west-1.compute.amazonaws.com:9000/dashboard/index?did=2 - Click on a specific project, you will see it's metrics.
Ex: http://ec2-52-17-13-23.eu-west-1.compute.amazonaws.com:9000/overview?id=1 - If you want to check your code quality on a local sonar server, please install sonar server locally and run this build command:
mvn clean package org.jacoco:jacoco-maven-plugin:prepare-agent install -Pcoverage-per-test -Dsonar.host.url=http://localhost:9000 sonar:sonar