-1

我是Sonar的新手。 我有多模块maven项目。 请看下面声纳报告+多模块maven + Jacoco插件

-Parent 
| -Module A 
    | 
    -pom.xml (Module A) 
| -Module B 
    | 
    -pom.xml (Module B) 
| -Module C 
| | 
| -pom.xml (Module C) 
| 
--pom.xml (parent pom) 

项目结构:(在模块A /模块B模块C被共享模块 - 装置,在内部模块C将所述的部分到模块A,模块B库)基于 项目要求我们有这些结构。

  1. 模块A - 适用于外部用户。
  2. 模块B - 适用于内部用户。
  3. 模块C - 共同b/w模块。

    我正在尝试为这两个模块创建单个声纳报告,但我无法将所有模块junit报告(模块A和模块B报告) 整合到单个报告中。多模块maven项目,但没有任何作品。

similar issue1similar issue2
github-example(声纳给出参考)

+0

我不明白你为什么加入jacoco - Maven的插件,sonarqube,Maven的的Cobertura-插件,sonarqube5.1,Maven的插件,如果你的问题是关于JUnit的......这些标签都不能匹配你的问题。 – Kraal

+0

@kraal:当你有多模块项目时,在这种情况下,为了覆盖整个项目的覆盖范围,我们必须在额外插件配置的帮助下合并J-unit报告。 –

+0

您的帖子中没有任何问题。你只是在写关于你无法“整合所有模块junit报告”的文章。那么你想要做什么?编辑您的文章,以便提供一个清晰的问题,人们尝试着回答(而不必去猜测你希望西隧) – Kraal

回答

-1

我能够实现使用声纳与Jococo插件集成测试覆盖率。 要在当地运行声纳,我在声纳中遇到了单片机错误的问题。每当它在声纳报告创建中失败时。 要解决本地问题,您需要在声纳中禁用SCM配置。 作为管理员在本地声纳登录 - admin/admin(默认用户名/密码) 现在在设置下我们有SCM选项卡 - 禁用SCM Senor并保存SCM设置。

sonar setting window

现在,在仪表板 - >配置部件.Search “集成测试覆盖”

enter image description here

现在,窗口小部件添加到您的项目仪表盘。

enter image description here

按照相同的配置在你的pom.xml在链接中给出。

https://github.com/SonarSource/sonar-examples/tree/master/projects/languages/java/code-coverage/combined%20ut-it/combined-ut-it-multimodule-maven-jacoco

0

我有类似的问题与40多个模块,其甚至被嵌套。你必须做的是在父pom中创建整个声纳配置。

<sonar.host.url>set url here (default is localhost)</sonar.host.url> 
<sonar.login>user for host url (default admin)</sonar.login> 
<sonar.password>password for host url (default is admin)</sonar.password> 
<sonar.projectName>optional name for whole project in sonar view</sonar.projectName> 
<sonar.projectDescription>optional project description for sonar view</sonar.projectDescription> 
<sonar.projectBaseDir>like name says you can set project base dir, if you have parent pom as a separate module then you can type ".." to set main directory with all modules</sonar.projectBaseDir> 

正确设置将分别对整个项目进行分析,所有模块:

<sonar.modules>module1, module2, module3</sonar.modules> 

配置适当他们每个人:

<module1.sonar.projectName>module1</module1.sonar.projectName> 
<module1.sonar.projectBaseDir>module1/</module1.sonar.projectBaseDir> 
<module1.sonar.sources>optionally set sources to proper directory for example src/main/java</module1.sonar.sources> 

<!-- similiar for other 2 projects --> 

这样,所有的JUnit报告将被使用每个模块,但它将被列入单个项目与模块。这样你就可以看到每个模块和整个单个项目的报告。

这是一个很好的做法将每一个模块后检查结果。如果失败,只需在控制台中检查错误并解决问题。