How to configure multi-module Maven + Sonar + JaCoCo to get overall coverage report in Sonar?

江枫思渺然 提交于 2019-12-12 03:33:26

问题


From the past one week I am trying to get code coverage of my multi module project using Sonar. My project structure is as follows.

Web Service XYX
   +- pom.xml
   +-SubFOlder
   +- Module 1
      +- pom.xml 
   +- Module 2
      +- pom.xml 
   +- Module3
      +- pom.xml 

Means I have one folder in my directory and inside that I have all my sub modules. am able to generate a jacoco.exec file in all the sub modules target directory. Want to know the way to combine all these submodules jacoco.exec so that I can get a merged code coverage in sonar report.


回答1:


As I've answered here: You can put all the reports together in one folder (don't forget to call the different!) and use the merge mojo for that, or use a central unique file to all your reports by adding the flag "append":

-javaagent:append=true,destFile=/home/YourProject/report.exec

Here you'll find more information about how to configure the agent.

Hope it helps!



来源:https://stackoverflow.com/questions/39193723/how-to-configure-multi-module-maven-sonar-jacoco-to-get-overall-coverage-rep

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!