嗨,我想使用maven.emma生成报告,当我尝试生成报告时,出现此错误。
[ERROR] Failed to execute goal org.codehaus.mojo:emma-maven-plugin:1.0-alpha-3:instrument (default) on project point-repo: Execution default of goal org.codehaus.mojo:emma-maven-plugin:1.0-alpha-3:instrument failed: CONSTANT_info: invalid tag value [18] -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.codehaus.mojo:emma-maven-plugin:1.0-alpha-3:instrument (default) on project point-repo: Execution default of goal org.codehaus.mojo:emma-maven-plugin:1.0-alpha-3:instrument failed: CONSTANT_info: invalid tag value [18]
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:224)
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.MojoExecutor.executeForkedExecutions(MojoExecutor.java:364)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:198)
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:120)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:347)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:154)
at org.apache.maven.cli.MavenCli.execute(MavenCli.java:584)
at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:213)
at org.apache.maven.cli.MavenCli.main(MavenCli.java:157)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:483)
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.PluginExecutionException: Execution default of goal org.codehaus.mojo:emma-maven-plugin:1.0-alpha-3:instrument failed: CONSTANT_info: invalid tag value [18]
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:143)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:208)
... 23 more
Caused by: java.lang.IllegalStateException: CONSTANT_info: invalid tag value [18]
at com.vladium.jcd.cls.constant.CONSTANT_info.new_CONSTANT_info(CONSTANT_info.java:103)
at com.vladium.jcd.parser.ClassDefParser$classParser.constant_pool(ClassDefParser.java:168)
at com.vladium.jcd.parser.ClassDefParser$classParser.class_table(ClassDefParser.java:109)
at com.vladium.jcd.parser.ClassDefParser.parseClass(ClassDefParser.java:56)
at com.vladium.emma.instr.InstrProcessorST.handleFile(InstrProcessorST.java:468)
at com.vladium.util.IPathEnumerator$Factory$PathEnumerator.enumeratePathDir(IPathEnumerator.java:193)
at com.vladium.util.IPathEnumerator$Factory$PathEnumerator.enumeratePathDir(IPathEnumerator.java:177)
at com.vladium.util.IPathEnumerator$Factory$PathEnumerator.enumeratePathDir(IPathEnumerator.java:177)
at com.vladium.util.IPathEnumerator$Factory$PathEnumerator.enumeratePathDir(IPathEnumerator.java:177)
at com.vladium.util.IPathEnumerator$Factory$PathEnumerator.enumeratePathDir(IPathEnumerator.java:177)
at com.vladium.util.IPathEnumerator$Factory$PathEnumerator.enumeratePathDir(IPathEnumerator.java:177)
at com.vladium.util.IPathEnumerator$Factory$PathEnumerator.enumeratePathDir(IPathEnumerator.java:177)
at com.vladium.util.IPathEnumerator$Factory$PathEnumerator.enumerate(IPathEnumerator.java:97)
at com.vladium.emma.instr.InstrProcessorST._run(InstrProcessorST.java:715)
at com.vladium.emma.Processor.run(Processor.java:88)
at org.codehaus.mojo.emma.task.InstrumentTask.execute(InstrumentTask.java:106)
at org.codehaus.mojo.emma.EmmaInstrumentMojo.doExecute(EmmaInstrumentMojo.java:158)
at org.codehaus.mojo.emma.AbstractEmmaMojo.execute(AbstractEmmaMojo.java:98)
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:132)
... 24 more
[ERROR]
这就是我向maven添加插件的方式。我只生成测试用例的代码覆盖率报告。是否有人收到此错误?
<reporting>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-project-info-reports-plugin</artifactId>
<version>2.7</version>
<configuration>
<dependencyLocationsEnabled>false</dependencyLocationsEnabled>
</configuration>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>emma-maven-plugin</artifactId>
<version>1.0-alpha-3</version>
<inherited>true</inherited>
</plugin>
</plugins>
</reporting>
最佳答案
您不应该使用emma插件,因为它集成了Emma which hasn't been updated in nearly a decade。即使没有更新,它仍然可以工作多年。
最终,it was succeeded by EclEmma最终重新基于JaCoCo(Java代码覆盖率)。
因此,现在,您需要jacoco plugin,已对其进行更新以与Java泛型以及新的功能接口(interface)保持同步。