我正在尝试使用JaCoCo为代码覆盖添加报表生成。该项目使用Maven,所以我有Jacoco maven插件配置如下:
<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>
surefire插件如下:
<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>
但是在跑步的最后
mvn清洁包
我犯了这样的错误:
[错误]无法执行目标组织。jacoco:jacocomaven插件:0.7。5.201505241946:项目LMS的报告(report):JaCoCo测试报告生成中出现错误。创建报告时出错:无效的文字/长度代码-
问题是,在另一个项目上,同样的东西就像一个符咒。我无法在网上找到解决方案。有人有什么想法吗?
使用-e开关,我得到以下错误:
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
我也曾经面对过这个问题。这似乎与jacoo分析器无法解析某些资源(可能是git子模块或其中的zip/binary)有关。只需忽略此任务的resources文件夹的路径即可修复此问题。
见:https://github.com/devhub-tud/devhub/commit/c21607d753fbac1ba26e8b14d4ba84f4487620f8
以及:https://github.com/devhub-tud/devhub/tree/master/src/main/resources/static
我试图设置为我的项目的代码覆盖 我的项目基于 下面是我项目的 然后我运行并看到以下内容 然后我运行,我看到 问题 -配置中有什么不正确 -如何生成报告? 谢啦
我有一个与jacoco的项目,我希望能够过滤某些类和/或包。 我阅读了以下文档: 使用Sonarrunner和Gradle(不使用sonar)从Jacoco报告中排除包 Jacoco-从报表中排除JSP(它似乎适用于maven,我使用的是gradle) Maven Jacoco配置-从不工作的报告中排除类/包(这似乎适用于Maven,我使用的是gradle)
Jacoco插件在jenkins报告中显示0%的覆盖率,但当我在本地系统中运行相同的命令时,Jacoco会正确生成报告。我正在使用以下命令: mvn-s xyz/settings.xml-f xyz/xyz/pom.xml清洁安装org.jacoco 所以当我在jenkins中运行这个命令时,它会生成错误的报告。我已经检查了它在工作区目录对应的项目在詹金斯。它显示每个项目的0%覆盖率。但是当我在本
我正在尝试使用JaCoCo-javaagent传递VM参数来获得代码覆盖率 -Java agent:/test/jaco co/jaco agent . jar = dest file =/test/jaco co/jaco co . exec,includes=com。*,append=true 我能在jacoco中获得一些价值。执行文件,但无法获取覆盖率报告。我怎样才能把jacoco转化成。执
当运行Gradle的Jacoco插件时,我在一组选定的类上得到零代码覆盖率报告。我已经确认测试这些类的所有单元测试都已成功运行。 非常有趣的是,EclEmma在Eclipse中生成了正确的代码覆盖率结果。我已经确认这两个工具使用的是相同版本的Jacoco。 我想知道这两种工具的区别是什么?我需要Gradle Jacoco插件的额外配置吗。 编辑:我的Gradle Jacoco输出显示“com类的执