私のプロジェクトはJava 1.8
とmaven 3.2.1
を使用しています
Corbetura
プラグインを次のように使用しています
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>cobertura-maven-plugin</artifactId>
<version>2.6</version>
<configuration>
<format>xml</format>
<maxmem>256m</maxmem>
<aggregate>true</aggregate>
<outputDirectory>shippable/codecoverage</outputDirectory>
</configuration>
</plugin>
<plugin>
<groupId>org.Apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.17</version>
<dependencies>
<dependency>
<groupId>org.Apache.maven.surefire</groupId>
<artifactId>surefire-junit4</artifactId>
<version>2.17</version>
</dependency>
</dependencies>
<configuration>
<redirectTestOutputToFile>true</redirectTestOutputToFile>
<reportsDirectory>shippable/testresults</reportsDirectory>
</configuration>
</plugin>
そして私はします
mvn clean cobertura:cobertura
そして私は以下を見る
[WARNING]
[WARNING] Some problems were encountered while building the effective settings
[WARNING] 'usePluginRegistry' is deprecated and has no effect. @ /Users/harith/.m2/settings.xml
[WARNING]
[INFO] Scanning for projects...
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Build Order:
[INFO]
[INFO] Oauth: Assembling Modules
[INFO] OAuth: Persistence
[INFO] OAuth: Business
[INFO] OAuth: REST
[INFO] OAuth: Integration Tests
[INFO]
[INFO] Using the builder org.Apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder with a thread count of 1
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building Oauth: Assembling Modules 1.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-clean-plugin:2.5:clean (default-clean) @ oauth ---
[INFO] Deleting /Users/harith/code/IdeaProjects/others/oauth/target
[INFO]
[INFO] >>> cobertura-maven-plugin:2.6:cobertura (default-cli) @ oauth >>>
[INFO]
[INFO] --- cobertura-maven-plugin:2.6:instrument (default-cli) @ oauth ---
[INFO] Skipping cobertura mojo for project with packaging type 'pom'
[INFO]
[INFO] <<< cobertura-maven-plugin:2.6:cobertura (default-cli) @ oauth <<<
[INFO]
[INFO] --- cobertura-maven-plugin:2.6:cobertura (default-cli) @ oauth ---
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building OAuth: Persistence 1.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-clean-plugin:2.5:clean (default-clean) @ persistence ---
[INFO] Deleting /Users/harith/code/IdeaProjects/others/oauth/persistence/target
[INFO]
[INFO] >>> cobertura-maven-plugin:2.6:cobertura (default-cli) @ persistence >>>
[INFO]
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ persistence ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 1 resource
[INFO]
[INFO] --- maven-compiler-plugin:3.1:compile (default-compile) @ persistence ---
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 4 source files to /Users/harith/code/IdeaProjects/others/oauth/persistence/target/classes
[INFO]
[INFO] --- cobertura-maven-plugin:2.6:instrument (default-cli) @ persistence ---
[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 /Users/harith/code/IdeaProjects/others/oauth/persistence/target/generated-classes/cobertura/com/self/oauth/persistence/entities/services/OauthEntityManager.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)
[cobertura] WARN [main] net.sourceforge.cobertura.instrument.CoberturaInstrumenter - Unable to instrument file /Users/harith/code/IdeaProjects/others/oauth/persistence/target/generated-classes/cobertura/com/self/oauth/persistence/entities/services/OauthEntityManagerProducer.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)
[cobertura] WARN [main] net.sourceforge.cobertura.instrument.CoberturaInstrumenter - Unable to instrument file /Users/harith/code/IdeaProjects/others/oauth/persistence/target/generated-classes/cobertura/com/self/oauth/persistence/entities/User.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)
[cobertura] WARN [main] net.sourceforge.cobertura.instrument.CoberturaInstrumenter - Unable to instrument file /Users/harith/code/IdeaProjects/others/oauth/persistence/target/generated-classes/cobertura/com/self/oauth/persistence/entities/UserService.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)
[ERROR] Aug 13, 2014 11:21:26 AM net.sourceforge.cobertura.coveragedata.CoverageDataFileHandler saveCoverageData
INFO: Cobertura: Saved information on 0 classes.
[INFO] Instrumentation was successful.
[INFO] NOT adding cobertura ser file to attached artifacts list.
[INFO]
[INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) @ persistence ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 1 resource
[INFO]
[INFO] --- maven-compiler-plugin:3.1:testCompile (default-testCompile) @ persistence ---
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 1 source file to /Users/harith/code/IdeaProjects/others/oauth/persistence/target/test-classes
[INFO]
[INFO] --- maven-surefire-plugin:2.17:test (default-test) @ persistence ---
[INFO] Surefire report directory: /Users/harith/code/IdeaProjects/others/oauth/persistence/shippable/testresults
[INFO] Using configured provider org.Apache.maven.surefire.junit4.JUnit4Provider
-------------------------------------------------------
T E S T S
-------------------------------------------------------
Running com.self.oauth.persistence.entities.UserServiceTest
Tests run: 3, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 1.404 sec - in com.self.oauth.persistence.entities.UserServiceTest
Results :
Tests run: 3, Failures: 0, Errors: 0, Skipped: 0
[INFO]
[INFO] <<< cobertura-maven-plugin:2.6:cobertura (default-cli) @ persistence <<<
[INFO]
[INFO] --- cobertura-maven-plugin:2.6:cobertura (default-cli) @ persistence ---
[INFO] Cobertura 2.0.3 - GNU GPL License (NO WARRANTY) - See COPYRIGHT file
Report time: 40ms
[ERROR] Aug 13, 2014 11:21:28 AM net.sourceforge.cobertura.coveragedata.CoverageDataFileHandler loadCoverageData
INFO: Cobertura: Loaded information on 0 classes.
[INFO] Cobertura Report generation was successful.
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building OAuth: Business 1.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-clean-plugin:2.5:clean (default-clean) @ business ---
[INFO] Deleting /Users/harith/code/IdeaProjects/others/oauth/business/target
[INFO]
[INFO] >>> cobertura-maven-plugin:2.6:cobertura (default-cli) @ business >>>
[INFO]
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ business ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory /Users/harith/code/IdeaProjects/others/oauth/business/src/main/resources
[INFO]
[INFO] --- maven-compiler-plugin:3.1:compile (default-compile) @ business ---
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 4 source files to /Users/harith/code/IdeaProjects/others/oauth/business/target/classes
[INFO]
[INFO] --- cobertura-maven-plugin:2.6:instrument (default-cli) @ business ---
[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 /Users/harith/code/IdeaProjects/others/oauth/business/target/generated-classes/cobertura/com/self/oauth/business/oauth/ClientRegistrationManager.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)
[cobertura] WARN [main] net.sourceforge.cobertura.instrument.CoberturaInstrumenter - Unable to instrument file /Users/harith/code/IdeaProjects/others/oauth/business/target/generated-classes/cobertura/com/self/oauth/business/oauth/TokenManager.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)
[cobertura] WARN [main] net.sourceforge.cobertura.instrument.CoberturaInstrumenter - Unable to instrument file /Users/harith/code/IdeaProjects/others/oauth/business/target/generated-classes/cobertura/com/self/oauth/business/oauth/UniqueIdGenerator.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)
[cobertura] WARN [main] net.sourceforge.cobertura.instrument.CoberturaInstrumenter - Unable to instrument file /Users/harith/code/IdeaProjects/others/oauth/business/target/generated-classes/cobertura/com/self/oauth/business/outbound/ClientDetail.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)
[ERROR] Aug 13, 2014 11:21:29 AM net.sourceforge.cobertura.coveragedata.CoverageDataFileHandler saveCoverageData
INFO: Cobertura: Saved information on 0 classes.
[INFO] Instrumentation was successful.
[INFO] NOT adding cobertura ser file to attached artifacts list.
[INFO]
[INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) @ business ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 0 resource
[INFO]
[INFO] --- maven-compiler-plugin:3.1:testCompile (default-testCompile) @ business ---
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 3 source files to /Users/harith/code/IdeaProjects/others/oauth/business/target/test-classes
[INFO]
[INFO] --- maven-surefire-plugin:2.17:test (default-test) @ business ---
[INFO] Surefire report directory: /Users/harith/code/IdeaProjects/others/oauth/business/shippable/testresults
[INFO] Using configured provider org.Apache.maven.surefire.junit4.JUnit4Provider
-------------------------------------------------------
T E S T S
-------------------------------------------------------
Running com.self.oauth.business.oauth.ClientRegistrationManagerTest
Tests run: 2, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 1.608 sec - in com.self.oauth.business.oauth.ClientRegistrationManagerTest
Running com.self.oauth.business.oauth.TokenManagerTest
Tests run: 2, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.15 sec - in com.self.oauth.business.oauth.TokenManagerTest
Running com.self.oauth.business.oauth.UniqueIdGeneratorTest
Tests run: 4, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.005 sec - in com.self.oauth.business.oauth.UniqueIdGeneratorTest
Results :
Tests run: 8, Failures: 0, Errors: 0, Skipped: 0
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building OAuth: Integration Tests 1.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-clean-plugin:2.5:clean (default-clean) @ integration ---
[INFO] Deleting /Users/harith/code/IdeaProjects/others/oauth/integration/target
[INFO]
[INFO] >>> cobertura-maven-plugin:2.6:cobertura (default-cli) @ integration >>>
[INFO]
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ integration ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 0 resource
[INFO]
[INFO] --- maven-compiler-plugin:3.1:compile (default-compile) @ integration ---
[INFO] Nothing to compile - all classes are up to date
[INFO]
[INFO] --- sql-maven-plugin:1.5:execute (default) @ integration ---
[INFO] Executing commands
[INFO] 1 of 1 SQL statements executed successfully
[INFO]
[INFO] --- cobertura-maven-plugin:2.6:instrument (default-cli) @ integration ---
[WARNING] No files to instrument.
[INFO] NOT adding cobertura ser file to attached artifacts list.
[INFO]
[INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) @ integration ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory /Users/harith/code/IdeaProjects/others/oauth/integration/src/test/resources
[INFO]
[INFO] --- maven-compiler-plugin:3.1:testCompile (default-testCompile) @ integration ---
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 4 source files to /Users/harith/code/IdeaProjects/others/oauth/integration/target/test-classes
[INFO]
[INFO] --- maven-surefire-plugin:2.17:test (default-test) @ integration ---
[INFO] Surefire report directory: /Users/harith/code/IdeaProjects/others/oauth/integration/shippable/testresults
[INFO] Using configured provider org.Apache.maven.surefire.junit4.JUnit4Provider
-------------------------------------------------------
T E S T S
-------------------------------------------------------
Results :
Tests run: 0, Failures: 0, Errors: 0, Skipped: 0
[INFO]
[INFO] <<< cobertura-maven-plugin:2.6:cobertura (default-cli) @ integration <<<
[INFO]
[INFO] --- cobertura-maven-plugin:2.6:cobertura (default-cli) @ integration ---
[INFO] Executing aggregate cobertura:report for Oauth: Assembling Modules
Aug 13, 2014 11:21:33 AM net.sourceforge.cobertura.coveragedata.CoverageDataFileHandler loadCoverageData
INFO: Cobertura: Loaded information on 0 classes.
Aug 13, 2014 11:21:33 AM net.sourceforge.cobertura.coveragedata.CoverageDataFileHandler loadCoverageData
INFO: Cobertura: Loaded information on 0 classes.
Aug 13, 2014 11:21:33 AM net.sourceforge.cobertura.coveragedata.CoverageDataFileHandler loadCoverageData
INFO: Cobertura: Loaded information on 0 classes.
[INFO] Saving aggregate cobertura information in /Users/harith/code/IdeaProjects/others/oauth/target/cobertura/cobertura.ser
Aug 13, 2014 11:21:33 AM net.sourceforge.cobertura.coveragedata.CoverageDataFileHandler saveCoverageData
INFO: Cobertura: Saved information on 0 classes.
[INFO] Cobertura 2.0.3 - GNU GPL License (NO WARRANTY) - See COPYRIGHT file
Report time: 42ms
[ERROR] Aug 13, 2014 11:21:33 AM net.sourceforge.cobertura.coveragedata.CoverageDataFileHandler loadCoverageData
INFO: Cobertura: Loaded information on 0 classes.
[INFO] Cobertura Report generation was successful.
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary:
[INFO]
[INFO] Oauth: Assembling Modules ......................... SUCCESS [ 0.597 s]
[INFO] OAuth: Persistence ................................ SUCCESS [ 3.532 s]
[INFO] OAuth: Business ................................... SUCCESS [ 2.784 s]
[INFO] OAuth: REST ....................................... SUCCESS [ 0.694 s]
[INFO] OAuth: Integration Tests .......................... SUCCESS [ 0.976 s]
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 8.784 s
[INFO] Finished at: 2014-08-13T11:21:33-08:00
[INFO] Final Memory: 28M/101M
[INFO] --------------------------------------------------------
最後にそれは言う
Cobertura: Loaded information on 0 classes.
ここで何が問題なのですか?
2015年5月10日更新:現在、バージョン2.7は(明らかに)これをサポートしています-ありがとう@tomasz_kusmierczyk
これは、Cobertura2.0.3がJava 8。をサポートしないASM4.1に依存しているためです。cobertura-maven-pluginにASM5.0を使用させることで、これを「修正」することができました。 3、しかし私はこれが物事を行う正しい方法であるかどうか完全にはわかりませんが、それはそれらの警告のすべてを取り除きました。
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>cobertura-maven-plugin</artifactId>
<version>2.6</version>
...
<dependencies>
<dependency>
<groupId>org.ow2.asm</groupId>
<artifactId>asm</artifactId>
<version>5.0.3</version>
</dependency>
</dependencies>
</plugin>
正しい方法は、おそらく JaCoCo のような別のコードカバレッジツールを使用することです。これは、Java 8をサポートすることを目的としています。
Update:このルートをたどると、コードカバレッジ情報が失われるようです。そのため、別のCCツールを使用することをお勧めします。
から https://github.com/cobertura/cobertura/wiki/FAQ#classnotfoundexception-during-instrumentation :
「これは、cobertura 2.0でのインストルメンテーション中に、ASMを使用して.classファイルを再構築するためです。Java 7以降と互換性があるための要件であるスタックマップを再構築します。これは、つまり、コードを再コンパイルしますが、ASMでは、スーパーメソッドを検索する必要がある場合に備えて、他のクラスのバイナリを提供する必要があります。これを修正するには、auxClasspathという引数を使用します。」
次のコードをantファイル(build.xml)に追加すると、問題が解決するはずです。
<path id="cobertura.auxpath">
<pathelement location="${bin}"/>
</path>
<target name="instrument_coverage" depends="init_coverage"
description="Instruments source code for coverage measurement">
<cobertura-instrument datafile="${coverage.datafile}">
<fileset refid="coverage-files"/>
<auxClasspath>
<path refid="cobertura.auxpath" />
</auxClasspath>
</cobertura-instrument>
</target>
これは私のために働いた。