Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

cobertura-maven-plugin with Java 8

Is it just me or the cobertura-maven-plugin doesn't work with java 8? when it runs I get

[INFO] --- cobertura-maven-plugin:2.6:instrument (default) @ provider-impl ---
[INFO] Cobertura 2.0.3 - GNU GPL License (NO WARRANTY) - See COPYRIGHT file
[cobertura] WARN  [main] net.sourceforge.cobertura.instrument.CoberturaInstrumenter - Unable to instrument file /var/lib/jenkins/workspace/BranchBuilder/implementations/provider-impl/target/generated-classes/cobertura/com/foo/impl/internal/ServiceProviderImpl$JoinRunner.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)

I know there were issues with ASM and java 8 so I suspect the issue is that the maven-plugin has not been updated to use a java-8 compatible version of ASM

For reference, I asked the question here but got no answer

Has anyone managed to use cobertura-maven-plugin with java 8?

like image 509
Hilikus Avatar asked Sep 02 '14 16:09

Hilikus


People also ask

Does cobertura support java8?

cobertura-maven-plugin does not support Java 1.8 properly #21.

How do I use cobertura maven plugin?

Cobertura Code Coverage Report Do nothing, just type the following Maven command to download and run the maven-cobertura-plugin automatically. Maven will generate the Cobertura code coverage report at ${project}/target/site/cobertura/index. html . Please refer to this Cobertura Maven Plugin for more examples.

How do I add cobertura plugin to Eclipse?

Step 2: Select eCobertura Code Coverage, click “next”, and then follow the steps in the installation wizard. Now that eCobertura is installed, restart Eclipse and show the coverage session view under Windows → Show View → Other → Cobertura.


2 Answers

I was able to get it working by manually updating the ASM dependency used by the cobetura-maven-plugin. Here is a link with more details: http://www.befreeman.com/2014/09/getting-cobertura-code-coverage-with.html

like image 106
Brian F Avatar answered Oct 06 '22 09:10

Brian F


It is an open issue to make it understand new classformat ,
https://github.com/mojohaus/cobertura-maven-plugin/issues/21

like image 41
jmj Avatar answered Oct 06 '22 09:10

jmj