为什么 sonar:sonar 之前需要 mvn install ?

2024-05-10Java开发问题
4

本文介绍了为什么 sonar:sonar 之前需要 mvn install ?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

问题描述

官方文档 http://docs.sonarqube.org/display/SONAR/Analyzing+with+Maven 说调用声纳的正确方法是:

mvn clean install -DskipTests=truemvn 声纳:声纳

但没有说明原因.声纳如何工作?它需要编译类吗?那么为什么不直接mvn clean compile呢?还是需要一个jar文件?那么为什么不直接mvn clean package呢?声纳插件到底是做什么的?

解决方案

来自SonarSource 团队成员的解释::p><块引用>

在多模块构建中,聚合器插件无法解析来自目标文件夹的依赖项.所以你有两个选择:

  • mvn clean install &&mvn sonar:sonar 作为两个独立的进程
  • mvn clean package sonar:sonar 作为单个反应器

我也很惊讶,所以我发了一个 tweet 并收到了以下 来自 Maven 官方账号的回答:

<块引用>

如果插件的设计目的不是使用 target/classes 文件夹作为替代,那么是的,您需要安装才能在运行时获取 jar *在不同的会话 *中.如果他们强迫您使用 install 没有 foo 原因,请向插件作者投诉 [ed - @connolly_s]

official documentation http://docs.sonarqube.org/display/SONAR/Analyzing+with+Maven says that the proper way of invoking sonar is:

mvn clean install -DskipTests=true
mvn sonar:sonar

but doesn't say why. how does sonar work? does it need compiled classes? so why not just mvn clean compile? or does it need a jar file? so why not just mvn clean package? what exactly does sonar plugin?

解决方案

Explanation from a SonarSource team member:

In a multi-module build an aggregator plugin can't resolve dependencies from target folder. So you have two options:

  • mvn clean install && mvn sonar:sonar as two separate processes
  • mvn clean package sonar:sonar as a single reactor

I was surprised too, so I made a tweet an received the following answer from the official Maven account:

If the plugin is not designed to use the target/classes folder as a substitute, then yes you would need to have installed to get the jar when running *in a different session*. Complain to the plugin author if they force you to use install without foo reason [ed - @connolly_s]

这篇关于为什么 sonar:sonar 之前需要 mvn install ?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

The End

相关推荐

如何使用 JAVA 向 COM PORT 发送数据?
How to send data to COM PORT using JAVA?(如何使用 JAVA 向 COM PORT 发送数据?)...
2024-08-25 Java开发问题
21

如何使报表页面方向更改为“rtl"?
How to make a report page direction to change to quot;rtlquot;?(如何使报表页面方向更改为“rtl?)...
2024-08-25 Java开发问题
19

在 Eclipse 项目中使用西里尔文 .properties 文件
Use cyrillic .properties file in eclipse project(在 Eclipse 项目中使用西里尔文 .properties 文件)...
2024-08-25 Java开发问题
18

有没有办法在 Java 中检测 RTL 语言?
Is there any way to detect an RTL language in Java?(有没有办法在 Java 中检测 RTL 语言?)...
2024-08-25 Java开发问题
11

如何在 Java 中从 DB 加载资源包消息?
How to load resource bundle messages from DB in Java?(如何在 Java 中从 DB 加载资源包消息?)...
2024-08-25 Java开发问题
13

如何更改 Java 中的默认语言环境设置以使其保持一致?
How do I change the default locale settings in Java to make them consistent?(如何更改 Java 中的默认语言环境设置以使其保持一致?)...
2024-08-25 Java开发问题
13