Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Next challenges

Recent achievements

  • Global
  • Personal


  • Give kudos
  • Received
  • Given


  • Global

Trophy case

Kudos (beta program)

Kudos logo

You've been invited into the Kudos (beta program) private group. Chat with others in the program, or give feedback to Atlassian.

View group

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

Clover Reporting for Multi Project Builds

I have a Gradle based Java/Groovy project that contains several subprojects. Let's say that subproject-a has a source class, subproject-b has a test class that tests the code under subproject-a. I am unable to figure out how to configure Clover to count the test coverage that subproject-b provides to subproject-a. I created an example project which shows a simple example of my issue. Combining each subproject's clover results does work fine, but the only code coverage that gets counted is when the source and test are in the same project.

I realize that the gradle-clover-plugin is an open source project, but is what I'm trying to do possible in Maven or Ant? I'm sure with Ant I could just build all the subprojects as one big single project and that would work, but I'd like to maintain my multi-project setup with project level dependencies.

I hope this makes sense. Thanks!

1 answer

1 accepted

0 votes
Answer accepted

I ran 'gradle cloverGenerateReport --debug'.

In the report I've found that the Dog class (from subproject-a) called from DogServiceTest (from subproject-b) has no coverage. I assume that this is a problem you're writing about.

In the build log I've found the following:

14:50:47.828 [DEBUG] [org.gradle.process.internal.DefaultWorkerProcessFactory] Creating Gradle Worker 3
14:50:47.828 [DEBUG] [org.gradle.process.internal.DefaultWorkerProcessFactory] Using application classpath [
  <workspace>\subproject-a\build\libs\subproject-a.jar, <<<<< USING subproject-a.jar

14:50:48.528 [DEBUG] [TestEventLogger] Gradle Worker 3 STARTED
14:50:48.533 [QUIET] [system.out] 14:50:48.532 [DEBUG] [org.gradle.api.internal.tasks.testing.junit.JUnitTestClassProcessor] Executing test class com.example.DogServiceTest


14:50:49.033 [DEBUG] [TestEventLogger] com.example.DogServiceTest > makeDogSpeakTest STANDARD_OUT
14:50:49.033 [DEBUG] [TestEventLogger]     Hello, my name is Mark

Please note that the subproject-b is using the ...\subproject-a\build\libs\subproject-a.jar and this JAR contains non-instrumented classes.

This is a reason why the Dog class has no coverage.

The JAR has non-instrumented classes, because the Gradle Clover Plugin has been written this way in order to be transparent and to avoid accidental deployment of instrumented code:

It means that, unfortunately, you cannot have a code coverage across modules, unless you'll hack the plugin and comment out this line:

This is really great, thanks for figuring this out for me. I'll talk with the maintainer of the clover plugin and see if we can do anything to better accommodate how this needs to work with clover. Looks like this should be supportable.

Indeed. Adding a switch for this should be trivial.

Suggest an answer

Log in or Sign up to answer
Community showcase
Published in Trello

What is a Trello board?

Hi, Atlassian Community! My name is Brittany Joiner and I am a Trello enthusiast and Atlassian Community Leader. I'll be sharing with you a series of videos with my top tips on how to best use Trel...

29 views 0 4
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you