简体   繁体   English

mvn sonar:sonar 有什么作用?

[英]What does mvn sonar:sonar do?

What are the maven lifecycle phases does the command mvn sonar:sonar execute?命令mvn sonar:sonar执行的 maven 生命周期阶段是什么?

While I see the logs that run over the screen, at a very high level test, install that I spotted out.当我看到在屏幕上运行的日志时,在非常高级的test, install我发现的。

Consider the following example,考虑下面的例子,

I have a maven project like the following我有一个像下面这样的 Maven 项目

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 mvn sonar:sonar -- 查看报告
  3. Modified child-2 by adding some test cases to increase the code coverage通过添加一些测试用例来修改 child-2 以增加代码覆盖率
  4. Run mvn sonar:sonar运行mvn sonar:sonar

My changes for the test cases are not reflecting in the report.我对测试用例的更改没有反映在报告中。

  1. I have deleted the report from sonarqube我已经从 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 ?简而言之,我是否需要执行mvn clean install然后执行mvn sonar:sonar

If mvn sonar:sonar covers executing the mvn clean install , why the report gives me old numbers?如果mvn sonar:sonar涵盖执行mvn clean install ,为什么报告给了我旧的数字?

mvn sonar:sonar does not trigger a mvn clean install execution. mvn sonar:sonar不会触发mvn clean install执行。 It triggers a Maven Surefire plugin execution only.它仅触发 Maven Surefire 插件执行。

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.这就是为什么您需要在每次分析之前执行mvn clean install - 否则您编译的类将不会是最新的,因此 Surefire 执行将不包括最近的修改。

Run the below cammand运行下面的命令

mvn clean install sonar:sonar mvn 干净安装声纳:声纳

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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