简体   繁体   中英

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?

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.

Run the below cammand

mvn clean install sonar:sonar

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM