jacoco:aggregate doesn't generate aggreagated jacoco.exec file

2,051 views
Skip to first unread message

prathi...@gmail.com

unread,
Dec 6, 2017, 10:59:32 AM12/6/17
to JaCoCo and EclEmma Users
Hello,

We are currently working on maven multi-module project, we have cross module tests so we have created a new module for aggregating the reports as stated in (https://github.com/jacoco/jacoco/wiki/MavenMultiModule).
The report aggregate goal works fine and generates only csv,xml and index.html files but does not generate an aggregated jacoco.exec file.
we need exec file to push it to sonarqube for analysis.

Please suggest a way where we can create aggregated exec file.

Thank you

Evgeny Mandrikov

unread,
Dec 7, 2017, 4:06:19 AM12/7/17
to JaCoCo and EclEmma Users
Hi,


On Wednesday, December 6, 2017 at 4:59:32 PM UTC+1, prathi...@gmail.com wrote:

Please suggest a way where we can create aggregated exec file.

 
There is
"merge" goal in jacoco-maven-plugin - http://www.jacoco.org/jacoco/trunk/doc/merge-mojo.html
"merge" task in JaCoCo Ant Tasks - http://www.jacoco.org/jacoco/trunk/doc/ant.html#merge

we need exec file to push it to sonarqube for analysis.

AFAIK for SonarQube you can specify multiple files in property "sonar.jacoco.reportPaths" - https://docs.sonarqube.org/display/PLUG/Code+Coverage+by+Unit+Tests+for+Java+Project

prathi...@gmail.com

unread,
Dec 7, 2017, 6:53:04 AM12/7/17
to JaCoCo and EclEmma Users
Hi

Thanks for the reply.

Wanted to know if 'aggregate' and 'merge' perform the same task.
Because of cross module test cases the jacoco results generated in the child modules doesn't show the coverage of other modules.
I was able to get the cross module code coverage only on using 'aggregate' task(which did not generate jacoco.exec)

So basically as per my understanding merge task will just merge all the jacoco.exec from modules into one, but these jacoco.exec doesn't have the cross module code coverage.

Please correct me if I'm wrong

Thank you !!

Evgeny Mandrikov

unread,
Dec 7, 2017, 8:27:24 AM12/7/17
to JaCoCo and EclEmma Users


On Thursday, December 7, 2017 at 12:53:04 PM UTC+1, prathi...@gmail.com wrote:

So basically as per my understanding merge task will just merge all the jacoco.exec from modules into one, but these jacoco.exec doesn't have the cross module code coverage. 

Please correct me if I'm wrong


You're wrong -  exec file contains information about classes no matter from which module they come.
"report-aggregate" doesn't affect exec files in any way and uses exactly the same ones.

Jithin John

unread,
Oct 9, 2018, 10:51:19 AM10/9/18
to JaCoCo and EclEmma Users
If I am right, jacoco.exec will have the coverage information about the unit module and the depending module. But I am not able to see the depending module coverage in Sonar. What could have I done wrong ? My sonar version is 5.6.7 

Evgeny Mandrikov

unread,
Oct 9, 2018, 11:26:31 AM10/9/18
to JaCoCo and EclEmma Users


On Tuesday, October 9, 2018 at 4:51:19 PM UTC+2, Jithin John wrote:


On Thursday, December 7, 2017 at 6:57:24 PM UTC+5:30, Evgeny Mandrikov wrote:


On Thursday, December 7, 2017 at 12:53:04 PM UTC+1, prathi...@gmail.com wrote:

So basically as per my understanding merge task will just merge all the jacoco.exec from modules into one, but these jacoco.exec doesn't have the cross module code coverage. 

Please correct me if I'm wrong


You're wrong -  exec file contains information about classes no matter from which module they come.
"report-aggregate" doesn't affect exec files in any way and uses exactly the same ones.


If I am right, jacoco.exec will have the coverage information about the unit module and the depending module.

Yes - this is exactly what was said above.
 
But I am not able to see the depending module coverage in Sonar. What could have I done wrong ? My sonar version is 5.6.7 

As you can see in JaCoCo documentation on page https://www.jacoco.org/jacoco/trunk/doc/integrations.html : SonarQube integration is third-party, not developed by JaCoCo team.
So please ask respective vendor - SonarSource: https://community.sonarsource.com/
Before creation of a new thread in their community forum, first of all I highly advise you to read existing answer
which IMO pretty well explains case of multi-module Maven projects. Using google you also can find plenty of other articles about this.
And secondly don't expect that anyone will be able to blindly guess an answer on question "What could have I done wrong ?" without any additional details.


Regards,
Evgeny

Reply all
Reply to author
Forward
This conversation is locked
You cannot reply and perform actions on locked conversations.
0 new messages