Is support for multi-module projects where tests are isolated from code needing coverage planned ?

42 views
Skip to first unread message

prgp...@gmail.com

unread,
Aug 13, 2015, 1:27:00 PM8/13/15
to JaCoCo and EclEmma Users
I was working on a recent multi-module maven project where the unit tests are in a different module from the codes being tested. I noticed that is also the same structure that JaCoCo uses.

The only way that I could get Maven to generate a coverage report with JaCoCo was to use an ant task (org.jacoco.ant.ReportTask) within Maven, which always feels a little smelly to me, where I explicitly listed each and every module that contained code that I wanted to check for coverage on.

Whilst this worked I was unhappy with the size and brittleness of the resultant pom file.

So I have created a fork which added support for using Maven's reactor projects (there is a configuration option which has to be set before the changes will alter the behaviour of JaCoCo) to determine the set of directories (as opposed to just the current project's) to be included in the report:

https://github.com/prgp/jacoco/tree/prgp-fix-multi-module-reports

The only significant issue with this is that you must build the entire project (ie you cannot use -pl or -rf). It also obviously does not include any support for (additional) source directories to be added, but that would be a relatively simple addition if someone wanted that. I have only tested the above under Maven 3 as the project in question requires it.

I was wondering whether there are any plans to include something like this on the roadmap for JaCoCo ?

Philip

Marc Hoffmann

unread,
Aug 14, 2015, 4:08:47 AM8/14/15
to jac...@googlegroups.com
Hi Philip,

many thanks for taking the time to implementing this and lettung us
know.

May I ask you to create a pull request from your fork against
jacoco/jacoco? So we can properly discuss adoption at Github.

Regards,
-marc

prgp...@gmail.com

unread,
Aug 14, 2015, 5:27:41 AM8/14/15
to JaCoCo and EclEmma Users
> May I ask you to create a pull request from your fork against
> jacoco/jacoco? So we can properly discuss adoption at Github.

Certainly, the associated pull request is:

https://github.com/jacoco/jacoco/pull/336

Marc Hoffmann

unread,
Aug 14, 2015, 5:42:46 AM8/14/15
to jac...@googlegroups.com
Thanks!
> --
> 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/ab619241-33fb-46cd-8327-188770033740%40googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
This conversation is locked
You cannot reply and perform actions on locked conversations.
0 new messages