Note that there are some explanatory texts on larger screens.

plurals
  1. POcobertura problem with asm on the classpath
    primarykey
    data
    text
    <p>I've got a project setup using maven, Spring 2.5.6, Hibernate 3.2.6 and recently added cobertura 1.9rc1 for code coverage analysis. </p> <p>The first issue I ran into were classpath related errors because of two different versions of the asm.jar on the classpath. This issue would only rise when running the JUnit tests and trying to load the spring application context. </p> <p>According to the FAQ on cobertura project homepage: </p> <blockquote> <p>Why is Cobertura causing me to have classpath conflicts with ASM?</p> <p>Cobertura uses ASM to modify your bytecode. There are a few other popular programs that use ASM; Groovy and Hibernate, to name two. You could have problems if Cobertura uses a different version of asm and you add both versions to your classpath.</p> <p>Cobertura only uses ASM when instrumenting. Cobertura does not need ASM in your classpath when running tests. If you're seeing classpath conflicts, just make sure the asm jar that comes with Cobertura is used only by Cobertura, and only when instrumenting.</p> </blockquote> <p>So in my project pom I configured the dependency as follows:</p> <pre><code>&lt;dependency&gt; &lt;groupId&gt;net.sourceforge.cobertura&lt;/groupId&gt; &lt;artifactId&gt;cobertura&lt;/artifactId&gt; &lt;version&gt;1.9rc1&lt;/version&gt; &lt;exclusions&gt; &lt;exclusion&gt; &lt;groupId&gt;asm&lt;/groupId&gt; &lt;artifactId&gt;asm&lt;/artifactId&gt; &lt;/exclusion&gt; &lt;exclusion&gt; &lt;groupId&gt;asm&lt;/groupId&gt; &lt;artifactId&gt;asm-attrs&lt;/artifactId&gt; &lt;/exclusion&gt; &lt;/exclusions&gt; &lt;/dependency&gt; </code></pre> <p>Now I can run my unit tests from eclipse, my application also runs fine on the server.</p> <p>But, when I run mvn cobertura:cobertura on my project I get the following error: <strong>java.lang.NoClassDefFoundError: net/sourceforge/cobertura/coveragedata/TouchCollector</strong></p> <p>I assume this is because the wrong asm.jar is on the classpath. But how else can I solve this classpath conflict, as stated in the cobertura faq?</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload