Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What does mvn sonar:sonar do?

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

  1. mvn clean install
  2. mvn sonar:sonar -- See the report
  3. Modified child-2 by adding some test cases to increase the code coverage
  4. Run mvn sonar:sonar

My changes for the test cases are not reflecting in the report.

  1. I have deleted the report from sonarqube
  2. 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?

like image 713
Vinay Veluri Avatar asked Jan 09 '14 06:01

Vinay Veluri


1 Answers

mvn sonar:sonar does not trigger a mvn 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.

like image 94
Fabrice - SonarSource Team Avatar answered Oct 18 '22 14:10

Fabrice - SonarSource Team