What are the maven lifecycle phases does the command mvn sonar:sonar
execute?
While I see the logs that run over the screen, at a very high level test, install
that I spotted out.
Consider the following example,
I have a maven project like the following
maven-root
maven-child-1
maven-child-2
Consider the following scenario, I have done them sequentially at root level
mvn clean install
mvn sonar:sonar
-- See the report- Modified child-2 by adding some test cases to increase the code coverage
- Run
mvn sonar:sonar
My changes for the test cases are not reflecting in the report.
- I have deleted the report from sonarqube
mvn sonar:sonar
Still that generates me the old report.
In brief, Do I need to perform mvn clean install
and then mvn sonar:sonar
?
If mvn sonar:sonar
covers executing the mvn clean install
, why the report gives me old numbers?
mvn sonar:sonar
does not trigger amvn clean install
execution. It triggers a Maven Surefire plugin execution only.This is why you need to perform a
mvn clean install
before each analysis - otherwise your compiled classes won't be up-to-date and therefore the Surefire execution won't include recent modifications.Run the below cammand
mvn clean install sonar:sonar