I tried running a sonar analysis using a java project on Jenkins using the standard maven sonar:sonar goal and also using the post step>> Execute SonarQube scanner. The maven goal I used is.
clean org.jacoco:jacoco-maven-plugin:0.7.8:prepare-agent package org.jacoco:jacoco-maven-plugin:0.7.8:report sonar:sonar -Dmaven.test.failure.ignore=true
For SonarQube scanner I used the below maven goal
clean org.jacoco:jacoco-maven-plugin:0.7.8:prepare-agent package org.jacoco:jacoco-maven-plugin:0.7.8:report -Dmaven.test.failure.ignore=true
and in the Post step, I added Execute SonarQube scanner step.
Using maven sonar:sonar goal, I got 60% coverage and using the post step, I got only 49%. Not able to figure out the reason for the difference.
SonarQube version - 7.7 Sonar Scanner version - 3.3.0 Jenkins version - 2.164.3 Maven version - 3.6.1