Get the latest community edition and create a container based on it:
docker pull sonarqube
docker run -d --name sonarqube -p 9000:9000 sonarqube
docker run --stop-timeout 3600 sonarqube
mvn sonar:sonar \
-Dsonar.projectKey=org.example:codequality \
-Dsonar.host.url=http://localhost:9000 \
-Dsonar.login=$SONAR_TOKEN
</plugins>
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<version>0.7.7.201606060606</version>
<executions>
<execution>
<goals>
<goal>prepare-agent</goal>
</goals>
</execution>
<execution>
<id>report</id>
<phase>test</phase>
<goals>
<goal>report</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
Based on the previous configuration, JaCoCo will trigger with the test goal.
mvn clean test
View report at ‘target/site/jacoco/index.html’
mvn clean org.jacoco:jacoco-maven-plugin:prepare-agent install -Dmaven.test.failure.ignore=true
mvn sonar:sonar \
-Dsonar.projectKey=org.example:codequality \
-Dsonar.host.url=http://localhost:9000 \
-Dsonar.login=$SONAR_TOKEN
Make sure each test starts with "test" otherwise JaCoCo will ignore it.
mvn org.pitest:pitest-maven:mutationCoverage
mvn sonar:sonar -Dsonar.pitest.mode=reuseReport
View report at ‘target/site/pit-reports/index.html’