I tried to follow the instructions in this
article: http://java.dzone.com/articles/jacoco-maven-multi-module.
However, what I don’t like, is your “coverage” module has to hardcode
references to all the modules in your multi-module project. That means, that
when you need to add a new module, you must now update two places – both the
parent pom.xml, and the coverage pom.xml. People are likely to forget to do the
later, especially if a new developer is working on your project.
My solution is here. Basically, rather than
hard-coding references to the other
modules, we load the parent pom.xml and extract the list from the
<modules> tag. Two provisos: (1) this will not work for multi-level
multi-module projects; (2) this assumes you stick to Maven standard directory
structures. With some code changes, you could overcome those provisos.