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
--
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 [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/jacoco/4d2bbb30-60b1-44bf-b51c-1a6a3f779705%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.