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

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.

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

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 Sign up to answer
How to earn badges on the Atlassian Community

How to earn badges on the Atlassian Community

Badges are a great way to show off community activity, whether you’re a newbie or a Champion.

Learn more
Community showcase
Published yesterday in Confluence

Three common content challenges + how to manage them

An efficient enterprise content management system, or ECM, is a must-have for companies that create work online (cough   cough, all companies). If content calendars, marketing plans, and bu...

53 views 0 4
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