Sonar maven 插件:所有模块的相同项目密钥不起作用? [英] Sonar maven plugin: same project key for all modules does not work?
问题描述
我正在使用 sonar-maven-plugin 3.2 和 maven 3.3.9.在父 POM 中,我定义了 sonar.projectKey maven 属性.该值是有效的,我可以从声纳的打印输出中看到它.但是 mvn sonar:sonar 步骤失败,因为 maven 模块使用相同的项目键值,因为 maven 属性在所有模块中具有相同的值.声纳给出错误:
I am using sonar-maven-plugin 3.2 and maven 3.3.9. In the parent POM, I have the sonar.projectKey maven property defined. The value is in effect, I can see it from the printout of sonar. But the mvn sonar:sonar step fails, because the maven modules use the same project key value, because the maven property has the same value in all modules. Sonar gives the error:
项目..."不能有 2 个具有以下键的模块:...
Project '...' can't have 2 modules with the following key: ...
真的没有办法拥有一个包含所有 maven 模块的声纳项目吗?所有模块都必须是真正不同的声纳项目吗?
Is there really no way to have a single sonar project that contains all maven modules? Are all modules must be really different sonar projects?
我知道我可以将分支属性用作 hack,但我想避免这样做.如果有一种方法可以在声纳中使用包含所有 Maven 模块的单个项目密钥来创建一个 Maven 多模块项目,那将是最好的......
I am aware that I could use the branch property asa hack, but I would like to avoid doing that. If there is a way to have a maven multi module project in sonar with a single project key, containing all maven modules, that would be the best...
推荐答案
sonar.projectKey
sonar.projectKey
每个项目唯一的项目密钥.允许的字符有:字母、数字、'-'、'_'、'.'和':',至少有一个非数字.
使用Maven时,自动设置为<groupId>:<artifactId>
.
The project key that is unique for each project.
Allowed characters are: letters, numbers, '-', '_', '.' and ':', with at least one non-digit.
When using Maven, it is automatically set to <groupId>:<artifactId>
.
因此,删除您的 sonar.projectKey
配置,它应该可以工作.
Therefore, remove your sonar.projectKey
configuration and it should work.
(我也经历过同样的循环).
(I have been through the same loop).
这篇关于Sonar maven 插件:所有模块的相同项目密钥不起作用?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!