java.lang.NoClassDefFoundError: com_cenqua_clover/CoverageRecorder

This is coming from a previous thread that is read-only now unfortunately so here is the history:

========================================================

------

Jul 31, 2008

I have a multi-module project with maven clover2 plugin and clover 2.3.2. Module B pom.xml has dependency on a test-jar in Module A. I verified that the Module A has a target / clover/ test-classes dir generated with the required class in Module B.
When compiling with maven 2.0.7 (mvn clean install clover2:instrument clover2:clover) it tells me that the tests are failing in Module B.

CLOVER FATAL ERROR: Clover could not be initialised. Are you sure you have Clover in the runtime classpath? (class java.lang.NoClassDefFoundError:com_cenqua_clover/CloverVersionInfo)

When I look at surefire test reports - it shows me an error as below: testCardSaleTransaction(com.kryterion.ecom.PaymentManagerTest)
java.lang.NoClassDefFoundError: com_cenqua_clover/CoverageRecorder
at com.kryterion.jndi.context.TestingContextFactory.getInitialContext(TestingContextFactory.java:15)

Now I can definitely get around it by adding clover as a dependency to Module B, but that would wrap that jar file in the final web app war which we don't really want.
Can someone point me to the root cause of the problem and a correct fix for this?
Thank you

------

Supposed work around which is NOT working

Aug 8, 2010

Hi Jay,

This problem is due to the fact that Maven2 doesn't handle artifacts with two classifiers correctly. In your case, -clover and -tests .
The work around for this is to use the clover2:setup goal instead of clover2:instrument when running your build with clover on.

Cheers,
Nick

------

========================================================

We now write Jan 2012 and I am running into the same issue which is very frustrating ...

I am using clover2:setup but my build agents get horked by the clover run just like described above.

Would appreciate a statement if this issue is just not important enough to fix or what exactly is being done about this.

Thanks,

-Dirk

4 answers

2 votes

Hello Dirk,

Please note that the fastest way to get a response and a working solution is to raise an issue at http://support.atlassian.com. I suppose that the most optimal will be to use clover2:setup with a Clover configured in a profile running in a separate build (to make sure that no instrumented classes will 'leak' into the production binaries) and a separate maven local cache for installing 'cloverized' binaries. I'm eager to help you, but without full build logs, information about project structure, pom.xml files etc it's really hard to do this.

Regards
Marek

1 votes

See also this KB article.

Eddie Webb Community Champion Feb 11, 2013

Should have came back to this question, once I did get past it, sorry. BUt I think Marek's answer is right on.

In our case we were using Jetty in our mavenized projects to run IT tests on the bamboo agent and simply adding clover as a dependency to the Jetty plugin did the trick. This keeps it out of the production war/ear, but lets the instrumented code run through testing.

0 votes
Eddie Webb Community Champion Nov 13, 2012

DirkH, did you ever submit a ticket? What was the response?

0 votes
Eddie Webb Community Champion Nov 13, 2012

Could not find goal 'setup' in plugin com.atlassian.maven.plugins:maven-clover2-plugin:2.3.1 among available goals instrument, check, log, save-history, aggregate, instrumentInternal, clover

Suggest an answer

Log in or Join to answer
Community showcase
Teodora [Botron]
Published Thursday in Marketplace Apps

Jira Inferno: The Nine Circles of Jira Administration Hell

If you spend enough time as a Jira admin - whether you are managing a single, mid-sized instance, a large enterprise one or juggling multiple instances at once - you will eventually find yourself in ...

653 views 4 15
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
Atlassian Team Tour

Join us on the Team Tour

We're bringing product updates and pro tips on teamwork to ten cities around the world.

Save your spot