DZone
DevOps Zone
Thanks for visiting DZone today,
Edit Profile
  • Manage Email Subscriptions
  • How to Post to DZone
  • Article Submission Guidelines
Sign Out View Profile
  • Post an Article
  • Manage My Drafts
Over 2 million developers have joined DZone.
Log In / Join
  • Refcardz
  • Trend Reports
  • Webinars
  • Zones
  • |
    • Agile
    • AI
    • Big Data
    • Cloud
    • Database
    • DevOps
    • Integration
    • IoT
    • Java
    • Microservices
    • Open Source
    • Performance
    • Security
    • Web Dev
DZone > DevOps Zone > Message Cowboy - Code Coverage Reports with Cobertura and Coveralls

Message Cowboy - Code Coverage Reports with Cobertura and Coveralls

Ivan K user avatar by
Ivan K
·
Feb. 11, 15 · DevOps Zone · Interview
Like (0)
Save
Tweet
5.97K Views

Join the DZone community and get the full member experience.

Join For Free

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-soruce 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!


Code coverage

Published at DZone with permission of Ivan K. See the original article here.

Opinions expressed by DZone contributors are their own.

Popular on DZone

  • Data Lakes, Warehouses and Lakehouses. Which is Best?
  • Debugging Deadlocks and Race Conditions
  • Creating Event-Based Architecture on Top of Existing API Ecosystem
  • Growth in Java Development for Web and Mobile Apps

Comments

DevOps Partner Resources

X

ABOUT US

  • About DZone
  • Send feedback
  • Careers
  • Sitemap

ADVERTISE

  • Advertise with DZone

CONTRIBUTE ON DZONE

  • Article Submission Guidelines
  • MVB Program
  • Become a Contributor
  • Visit the Writers' Zone

LEGAL

  • Terms of Service
  • Privacy Policy

CONTACT US

  • 600 Park Offices Drive
  • Suite 300
  • Durham, NC 27709
  • support@dzone.com
  • +1 (919) 678-0300

Let's be friends:

DZone.com is powered by 

AnswerHub logo