java.lang.NoClassDefFoundError: com_cenqua_clover/CoverageRecorder

Dirk Hain January 9, 2012

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
Marek Parfianowicz
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
June 26, 2012

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 vote
Marek Parfianowicz
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
February 11, 2013

See also this KB article.

EddieW
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
February 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
EddieW
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
November 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

0 votes
EddieW
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
November 13, 2012

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

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events