I have included Cobertura in my Maven project using this guide. I added the following to my pom.xml
:
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>cobertura-maven-plugin</artifactId>
<version>2.6</version>
<configuration>
<formats>
<format>html</format>
<format>xml</format>
</formats>
<outputDirectory>${project.build.directory}/surefire-reports/cobertura</outputDirectory>
<instrumentation>
<ignoreTrivial>true</ignoreTrivial>
<ignores>
<ignore>org.slf4j.Logger.*</ignore>
</ignores>
<excludes>
</excludes>
</instrumentation>
</configuration>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>cobertura</goal>
</goals>
</execution>
</executions>
</plugin>
When I run the build I get errors like this:
[cobertura] WARN [main] net.sourceforge.cobertura.instrument.CoberturaInstrumenter - Unable to instrument file C:\MYSELF\programing\java\AutoCall\AutoClient\target\generated-classes\cobertura\cz\autoclient\autoclick\ComparablePixel.class
java.lang.IllegalArgumentException
at org.objectweb.asm.ClassReader.<init>(Unknown Source)
at org.objectweb.asm.ClassReader.<init>(Unknown Source)
at org.objectweb.asm.ClassReader.<init>(Unknown Source)
at net.sourceforge.cobertura.instrument.CoberturaInstrumenter.instrumentClass(CoberturaInstrumenter.java:147)
at net.sourceforge.cobertura.instrument.CoberturaInstrumenter.instrumentClass(CoberturaInstrumenter.java:121)
at net.sourceforge.cobertura.instrument.CoberturaInstrumenter.addInstrumentationToSingleClass(CoberturaInstrumenter.java:234)
at net.sourceforge.cobertura.instrument.Main.addInstrumentationToSingleClass(Main.java:298)
at net.sourceforge.cobertura.instrument.Main.addInstrumentation(Main.java:307)
at net.sourceforge.cobertura.instrument.Main.parseArguments(Main.java:399)
at net.sourceforge.cobertura.instrument.Main.main(Main.java:421)
They all appear to be in strange folder ProjectName\target\generated-classes\cobertura
which I definitely did not create. My report looks like this:
When I press Run All Tests
I just get the same errors as during build.
What is it? Report from Cobertura is required for my project, I must make it work.