Unit tests fails with Null Pointer Exceptions with clover 3.1.8 however all go through clean with clover 4.0.2

Ours is a multi module maven project and using clover2:instrument to generate instrumented fat jar.

We evaluate functional test code coverage using the instrumented jar from command line, all steps mentioned below :

1) mvn clean install

2) mvn -P instrumentation clover2:instrument

3) Run functional test 

4) mvn -P instrumentation clover2:aggregate

5) mvn -P instrumentation clover2:clover site

All unit tests passes with clover 4.0.2 however they fail with NPE when clover version 3.1.8 is used. We want to use older version because we have commercial license for it and not for newer version.

Kindly help.


I cannot share the logs as this might offend my organisation policies. Sharing the excerpt

Tests run: 6, Failures: 6, Errors: 0, Skipped: 0, Time elapsed: 0 sec <<< FAILURE!
com.***.*.*.*.*.drools.*.*************UnitTest.testKnowledgeAgentInitialization() Time elapsed: 0 sec <<< FAILURE!
 at com.***.*.*.*.*.drools.*.*************UnitTest.testKnowledgeAgentInitialization(*************UnitTest.java:149)


Parent POM for clover:



We are using Surefire to run Unit tests


3 answers

0 votes

Clover 3.x and Clover 4.x are not binary compatible (a lot of classes have been renamed), therefore you have to ensure that you don't mix the code generated by Clover 3.x with a code generated by Clover 4.x. Please have a look at the "Upgrading from Clover 3.3 to Clover 4.0" chapter in the https://confluence.atlassian.com/display/CLOVER/Clover+4.0+Release+Notes

Especially, when you switch from Clover 3.3 to 4.0 (or the opposite way), clean your entire workspace and ~/.m2 cache from old classes and jars:

It's recommended to delete or to rebuild all artifacts instrumented by Clover and having the 'clover' classifier (e.g. my-module-1.0-clover.jar) from ~/.m2 caches and build workspaces. When you run clover2:setup or clover:instrument, Clover tries to find an instrumented version of dependent artifacts and to use such "clovered" artifact instead of the original one. Due to a fact that some Clover's classes have been renamed in Clover 4, it may lead to java.lang.NoClassDefFoundError or java.lang.VerifyError at runtime when an instrumented JAR with old Clover will be found.


0 votes

One more thing. You have the following dependency declared:


Please note that for Clover 3.x the artifact should have:


Thanks Marek....but this didn't help....
1) I deleted all the clover jars from .m2 repo (del /S*-clover.jar) .

2)Ensured that dependency has proper groupId 


3)Ran clover2:instrument, (mvn -P instrumentation clover2:instrument >>log.txt)

This log file created shows Failed unit tests with Null Pointer Exception sad


Kindly help

You wrote that you cannot paste more details here due to your company's policies. However, would it be possible to attach this data to a support ticket (you can create one on support.atlassian.com)? Such ticket will be visible by you and by our Atlassian Support team only.

Do you mean to open an OnDemand ticket and since it is visible to only internal team , attach the entire log file of instrumentation run ?

Open https://support.atlassian.com, select "Dev Tools" and next select "Clover Support". Next log in using your AtlassianID (or create a new account) and please attach the Maven build log + one JUnit log (TEST-*.xml) from one failing test case.

Suggest an answer

Log in or Sign up to answer
Community showcase
Published Wednesday in Opsgenie

Getting the Most out of Atlassian and Opsgenie Together

We’re excited to invite you to this action-packed webinar where we will demonstrate how to integrate Opsgenie’s powerful alerting and on-call management tools with your entire Atlassian stack. Mar...

68 views 0 1
Read article

Atlassian User Groups

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

Find a group

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

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you