Message Cowboy – Code Coverage Reports with Cobertura and Coveralls

By | February 8, 2015
Reading Time: < 1 minute

After having spent some time trying to migrate my Message Coboy project from Maven to Gradle, I finally gave up. I guess Gradle is not for me and I do not see any significant gains in moving from Maven to Gradle, neither as far as my sparetime projects are concerned nor in the organization where I work.

The reason for me wanting to migrate to Gradle was not really Gradle in itself, but the cool badges with code coverage, download latest release etc that I saw on the Mockito project.
Fortunately there is a very nice Coveralls Maven plug-in with excellent documentation which I can recommend.

So what were the required modifications?
First I added the Cobertura and Coveralls plug-ins to the <build> section of my pom.xml:

            <!-- Generates code coverage report. -->
            <!-- Submit code coverage report to -->
                    <!-- Since I use Travis CI I do not have to put my Coveralls token here. -->

Second I added two lines in the .travis.yml file. The new version of the file looks like this:

language: java
- oraclejdk7

  - mvn clean cobertura:cobertura coveralls:report

Finally I signed up for Coveralls, which is free for all open-source projects, and copy-pasted the markup that displays the code coverage badge to the Message Cowboy file.

Many thanks to the developer of the Coveralls Maven plug-in and to the generous folks at Coveralls!


Leave a Reply

Your email address will not be published. Required fields are marked *