Questions about implementation of report aggregate

32 views
Skip to first unread message

Didier Crest

unread,
Oct 1, 2019, 10:56:09 AM10/1/19
to jac...@googlegroups.com

Dear JaCoCo Team,

 

I have been using report aggregation in maven multi modules in order to generate the code coverage report for multiple components.

 

One behaviour I am struggling to understand what is the benefits of using dependencies to access both the compiled code and the source code. I would have assumed that the reactorMavenProjects would be used instead of the dependencies.

 

Note that the current behaviour has as side effect that if one of the module packaging fail (no .jar produced) the aggregation report fail too. The code coverage of the source code would still produce significant added value to the user even if the packaging is failing.

 

In order to produce the behaviour I am expecting, I cloned the tag 0.8.4 and added the use of reactorMavenProjects object. The report produced is consistent to the one produced with the dependency (in case no failure occurs in the packaging phase) but is now allowing the generation of the report without executing the packaging phase. Additionally, in case of project with large number of sub module (e.g. >150) the presented approach does not require the list of dependency in the scope of the report, but use the inherited reactor execution plan, improving the maintainability of the content of the report.

 

I would like to know the rationales for the current implementation in order to avoid degrading the performance my instance of JaCoCo. If you find the behaviour I have implemented valuable, I would be glad to send a pull request.

 

 

 

Didier Crest
DevOps Engineer

THALES SERVICES SAS

www.thalesgroup.com

http://intranet.peopleonline.corp.thales/portal/outlook/signature/logo-thales-live.png

 

 

image001.png

Marc Hoffmann

unread,
Oct 1, 2019, 12:25:58 PM10/1/19
to JaCoCo and EclEmma Users
Hi Didier,

the decision for using dependencies is based on two assumptions:

1) The user want to control the content of the aggregated report
2) The report can only be created after all modules have been compiled and there test have been executed. So it actually is a dependency and you cannot create a valid report if building its content fails.

We took some notes about the design discussions we had at that time: https://github.com/jacoco/jacoco/wiki/MavenMultiModule

Regards,
-marc



-- 
You received this message because you are subscribed to the Google Groups "JaCoCo and EclEmma Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jacoco+un...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jacoco/016201d57868%245acf88e0%24106e9aa0%24%40thales-services.fr.

ctd.t...@gmail.com

unread,
Oct 2, 2019, 7:42:48 AM10/2/19
to JaCoCo and EclEmma Users
Hi Marc,

Thank you for your answer.
I didn't know how to answer with my company's mail. So I use a personal one.

I read the web page. I understand your point of view.
Indeed with a common multi module maven. To get the generated report I have to execute a maven command twice.
First with the clean and test phases. And a second one with the site phase.

For the first assumption, I thought profile and the exclude property are sufficient to control the content of the report.
But we can change the code to add the 2 behaviors. A global aggregate report in the root module and the implementation of dependencies for sub modules. Thus if someone wants to control his aggregation, he must create the report module with the dependencies he has chosen.


In the wiki, the strategy aggregator is a well-known problems with maven.

I didn't have the aggregator problem using a multi module structure define as follows (the multi-module Enterprise Project):
https://books.sonatype.com/mvnref-book/reference/pom-relationships-sect-pom-best-practice.html
With this structure, the aggregator is executed at the end of the reactor plan. And the report is well generated with a single maven command : mvn clean test site.

module-jacoco  
          ^             ^
          |              \
          |               \
module-agregator  \
         |                  \
         |                   \
         --------- module-parent
        |             ^       ^
        |             |        \
        |             |         \
        ----------module-1  \
        |                          \
        |                           \
        ---------------------module-2

[INFO] ------------------------------------------------------------------------
[INFO] Reactor Build Order:
[INFO]
[INFO] module-parent                                                    [pom]
[INFO] module-1                                                           [jar]
[INFO] module-2                                                           [jar]
[INFO] module-aggregator                                             [pom]
[DEBUG] === REACTOR BUILD PLAN ================================================

    

[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary:
[INFO]
[INFO] module-parent 1.0.0-SNAPSHOT ....................... SUCCESS [ 15.991 s]
[INFO] module-1 1.0.0-SNAPSHOT .............................. SUCCESS [  9.893 s]
[INFO] module-2 1.0.0-SNAPSHOT .............................. SUCCESS [  9.606 s]
[INFO] module-aggregator 1.0.0-SNAPSHOT ................ SUCCESS [ 17.180 s]
[INFO] ------------------------------------------------------------------------
    

I need to do further tests to make sure that the build order is the nominal case.
And test with the dependencies implementation the option -fae to check if the report is generated even if some tests or packaging have failed.

Regards,
Didier Crest


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