Ich versuche, die Berichtgenerierung für die Codeabdeckung mit JaCoCo hinzuzufügen. Das Projekt wird mit Maven, so habe ich jacoco Maven wie folgt konfiguriert Plugin:Fehler beim Erstellen des Codeabdeckungsberichts mit JaCoCo
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<version>${jacoco.maven.plugin.version}</version>
<executions>
<execution>
<id>prepare-agent</id>
<goals>
<goal>prepare-agent</goal>
</goals>
<configuration>
<destFile>${basedir}/target/coverage-reports/jacoco-unit.exec</destFile>
</configuration>
</execution>
<execution>
<id>report</id>
<phase>prepare-package</phase>
<goals>
<goal>report</goal>
</goals>
<configuration>
<dataFile>${basedir}/target/coverage-reports/jacoco-unit.exec</dataFile>
<outputDirectory>${basedir}/target/jacoco</outputDirectory>
</configuration>
</execution>
</executions>
</plugin>
Und todsichere Plugin wie folgt aus:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>${maven.surefire.plugin.version}</version>
<configuration>
<argLine>${argLine} -XX:-UseSplitVerifier</argLine>
<printSummary>true</printSummary>
<excludes>
<exclude>**/selenium/**/*.java</exclude>
<excludes>
</configuration>
</plugin>
Aber am Ende des
mvn clean package
läuft i bekomme einen solchen Fehler:
[ERROR] Failed to execute goal org.jacoco:jacoco-maven-plugin:0.7.5.201505241946:report (report) on project LMS: An error has occurred in JaCoCo Test report generation. Error while creating report: invalid literal/length code -> [Help 1] [ERROR] [ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch. [ERROR] Re-run Maven using the -X switch to enable full debug logging. [ERROR] [ERROR] For more information about the errors and possible solutions, please read the following articles: [ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException
Die Sache ist, auf einem anderen Projekt funktioniert die gleiche Sache wie ein Charme. Ich konnte online keine Lösung finden. Hat jemand irgendwelche Ideen?
Mit -en i die folgenden Fehlermeldungen erhalten:
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.jacoco:jacoco-maven-plugin:0.7.5.201505241946:report (report) on project LMS: An error has occurred in JaCoCo Test report generation.
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:216)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:116)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:80)
at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:51)
at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:128)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:307)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:193)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:106)
at org.apache.maven.cli.MavenCli.execute(MavenCli.java:862)
at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:286)
at org.apache.maven.cli.MavenCli.main(MavenCli.java:197)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289)
at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229)
at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415)
at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356)
Caused by: org.apache.maven.plugin.MojoExecutionException: An error has occurred in JaCoCo Test report generation.
at org.jacoco.maven.AbstractReportMojo.execute(AbstractReportMojo.java:180)
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:134)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:208)
... 20 more
Caused by: org.apache.maven.reporting.MavenReportException: Error while creating report: invalid literal/length code
at org.jacoco.maven.AbstractReportMojo.executeReport(AbstractReportMojo.java:196)
at org.jacoco.maven.AbstractReportMojo.execute(AbstractReportMojo.java:178)
... 22 more
Caused by: java.util.zip.ZipException: invalid literal/length code
at java.util.zip.InflaterInputStream.read(InflaterInputStream.java:164)
at java.util.zip.ZipInputStream.read(ZipInputStream.java:193)
at java.io.BufferedInputStream.fill(BufferedInputStream.java:235)
at java.io.BufferedInputStream.read(BufferedInputStream.java:254)
at org.jacoco.core.internal.ContentTypeDetector.readInt(ContentTypeDetector.java:95)
at org.jacoco.core.internal.ContentTypeDetector.determineType(ContentTypeDetector.java:68)
at org.jacoco.core.internal.ContentTypeDetector.<init>(ContentTypeDetector.java:63)
at org.jacoco.core.analysis.Analyzer.analyzeAll(Analyzer.java:172)
at org.jacoco.core.analysis.Analyzer.analyzeZip(Analyzer.java:246)
at org.jacoco.core.analysis.Analyzer.analyzeAll(Analyzer.java:178)
at org.jacoco.core.analysis.Analyzer.analyzeAll(Analyzer.java:208)
at org.jacoco.maven.BundleCreator.createBundle(BundleCreator.java:78)
at org.jacoco.maven.AbstractReportMojo.createReport(AbstractReportMojo.java:219)
at org.jacoco.maven.AbstractReportMojo.executeReport(AbstractReportMojo.java:193)
... 23 more
Stellen Sie sicher, Jacoco neueste Version verwenden. Es könnte auch eine gute Idee sein, Maven mit dem Schalter -e zu starten, wie es heißt. –
Ich benutze die neueste Version, ich habe auch versucht, mit -e Switch zu laufen, ich werde das Ergebnis jetzt in die Frage stellen – dty