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. --> <plugin> <groupId>org.codehaus.mojo</groupId> <artifactId>cobertura-maven-plugin</artifactId> <version>2.6</version> <configuration> <format>xml</format> <maxmem>256m</maxmem> </configuration> </plugin> <!-- Submit code coverage report to Coveralls.io. --> <plugin> <groupId>org.eluder.coveralls</groupId> <artifactId>coveralls-maven-plugin</artifactId> <version>3.0.1</version> <configuration> <!-- Since I use Travis CI I do not have to put my Coveralls token here. --> </configuration> </plugin> </plugins> </build> ...
Second I added two lines in the .travis.yml file. The new version of the file looks like this:
language: java jdk: - oraclejdk7 after_success: - 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 ReadMe.md file.
Many thanks to the developer of the Coveralls Maven plug-in and to the generous folks at Coveralls!