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

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(*************


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

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 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, 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 in Trello

The control freak's guide: using Trello to plan a relocation

My partner and I were planning this relocation for years. It was our shared dream to try and live in another country. As children of immigrants, we already have experienced this once, but this still ...

323 views 8 13
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