Hier soir deux inconnus, Et ce matin, sur l'avenue - Deux amoureux, tout etourdis , Par la longue nuit (Aux Champs Elysées - Joe Dassin)
In my post about JaCoCo I wrote about the problems of using JaCoCo Maven plugin in multimodule Maven project because of having one report for each module separately instead of one report for all modules, and how can be fixed it using JaCoCo Ant Task.
In current post we are going to see how to use Jacoco Jenkins plugin to achieve the same goal of Ant Task and have an overall code coverage statistic of all modules.
First step is installing JaCoCo Jenkins plugin.
Go to Go to Jenkins -> Manage Jenkins -> Plugin Manager -> Available and find for JaCoCo Plugin
Next step, if it is not done before, is configuring your JaCoCo Maven plugin into parent pom:
And finally a post-action must be configured to the job responsible of packaging the application. Note that in previous pom file reports are generated just before package goal is executed.
Go to Configure -> Post-build Actions -> Add post-build action -> Record JaCoCo coverage report.
Then we have to set folders or files containing JaCoCo XML reports, which using previous pom is **/target/site/jacoco/jacoco*.xml, and also set when we consider that a build is healthy in terms of coverage.
After project is build, a new report will appear just under test result trend graph, called code coverage trend, where we can see the code coverage of all project modules.
Furthermore visiting Jenkins main page a nice quick overview of a job when mouse is over the weather icon is shown:
Keep in mind that this approach for merging code coverage files will only work if you are using Jenkins as a CI system meanwhile Ant Task is more generic solution and can also be used with JaCoCo Jenkins plugin.
We Keep Learning,
Alex.
Music: http://www.youtube.com/watch?v=OAMuNfs89yE



