运行黑盒测试代码时出现错误。我正在使用最新的0.8.2 jacoco罐子,但它抛出以下错误:
BUILD FAILED
C:\project\build-continous-integration.xml:71: The following error occurred while executing this line:
C:\project\build-continous-integration.xml:94: The following error occurred while executing this line:
C:\project\build-continous-integration.xml:152: Error while creating report
at org.jacoco.ant.ReportTask.execute(ReportTask.java:501)
at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:292)
at jdk.internal.reflect.GeneratedMethodAccessor4.invoke(Unknown Source)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:566)
at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:99)
at org.apache.tools.ant.Task.perform(Task.java:350)
at org.apache.tools.ant.Target.execute(Target.java:449)
at org.apache.tools.ant.Target.performTasks(Target.java:470)
at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1388)
at org.apache.tools.ant.helper.SingleCheckExecutor.executeTargets(SingleCheckExecutor.java:36)
at org.apache.tools.ant.Project.executeTargets(Project.java:1251)
at org.apache.tools.ant.taskdefs.Ant.execute(Ant.java:437)
at org.apache.tools.ant.taskdefs.CallTarget.execute(CallTarget.java:105)
at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:292)
at jdk.internal.reflect.GeneratedMethodAccessor4.invoke(Unknown Source)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:566)
at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:99)
at org.apache.tools.ant.Task.perform(Task.java:350)
at org.apache.tools.ant.Target.execute(Target.java:449)
at org.apache.tools.ant.Target.performTasks(Target.java:470)
at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1388)
at org.apache.tools.ant.helper.SingleCheckExecutor.executeTargets(SingleCheckExecutor.java:36)
at org.apache.tools.ant.Project.executeTargets(Project.java:1251)
at org.apache.tools.ant.taskdefs.Ant.execute(Ant.java:437)
at org.apache.tools.ant.taskdefs.CallTarget.execute(CallTarget.java:105)
at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:292)
at jdk.internal.reflect.GeneratedMethodAccessor4.invoke(Unknown Source)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:566)
at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:99)
at org.apache.tools.ant.Task.perform(Task.java:350)
at org.apache.tools.ant.Target.execute(Target.java:449)
at org.apache.tools.ant.Target.performTasks(Target.java:470)
at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1388)
at org.apache.tools.ant.Project.executeTarget(Project.java:1361)
at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41)
at org.apache.tools.ant.Project.executeTargets(Project.java:1251)
at org.apache.tools.ant.Main.runBuild(Main.java:834)
at org.apache.tools.ant.Main.startAnt(Main.java:223)
at org.apache.tools.ant.launch.Launcher.run(Launcher.java:284)
at org.apache.tools.ant.launch.Launcher.main(Launcher.java:101)
Caused by: java.io.IOException: Error while analyzing
project\bc\infra\commands\AbstractCommand.class.
at org.jacoco.core.analysis.Analyzer.analyzerError(Analyzer.java:170)
at org.jacoco.core.analysis.Analyzer.analyzeClass(Analyzer.java:142)
at org.jacoco.core.analysis.Analyzer.analyzeClass(Analyzer.java:165)
at org.jacoco.core.analysis.Analyzer.analyzeAll(Analyzer.java:201)
at org.jacoco.ant.ReportTask.createBundle(ReportTask.java:570)
at org.jacoco.ant.ReportTask.createReport(ReportTask.java:542)
at org.jacoco.ant.ReportTask.execute(ReportTask.java:495)
... 42 more
Caused by: java.lang.IllegalArgumentException
at org.objectweb.asm.ClassReader.<init>(Unknown Source)
at org.objectweb.asm.ClassReader.<init>(Unknown Source)
at org.jacoco.core.analysis.Analyzer.analyzeClass(Analyzer.java:118)
at org.jacoco.core.analysis.Analyzer.analyzeClass(Analyzer.java:140)
... 47 more
我检查了很多主题,但是大多数问题都与插补类有关,但是在这里我看不到此错误。有人知道如何解决吗? 如果您需要更多信息,请告诉我。
谢谢。
答案 0 :(得分:2)
Caused by: java.lang.IllegalArgumentException
at org.objectweb.asm.ClassReader.<init>(Unknown Source)
对我来说,在ASM库的堆栈跟踪中,Unknown Source
唯一已知的情况是-使用其JAR(不包含调试信息)并且使用were removed in ASM version 6.0。因此,您可能使用的是ASM版本<6.0。
但是根据堆栈跟踪中模块名称的存在
at java.base/java.lang.reflect.Method.invoke(Method.java:566)
您正在使用Java> = 9。
ASM版本<6.0无法处理Java> = 9类,在这种情况下,恰好在IllegalArgumentException
处抛出了org.objectweb.asm.ClassReader.<init>
。
此外,JaCoCo 0.8.2 requires usage of ASM 6.2.1完全取决于此版本。
at org.jacoco.ant.ReportTask.execute(ReportTask.java:501)
对于Ant,您必须使用JaCoCo发行版中的lib/jacocoant.jar
而不是lib/org.jacoco.ant-0.8.2.201808211720.jar
,因为第一个包含所有必需的依赖项,而最后一个不包含。根据{{3}},它对应于Maven中央存储库中的工件,其groupId
是org.jacoco
,artifactId
是org.jacoco.ant
,最重要的是 classifier
是nodeps
。