我最近在我的Java/Spring-MVC项目中添加了Cobertura插件。奇怪的是,我所有的单元测试都通过了,当Maven进行初始测试运行时,它们仍然通过,但是当Cobertura尝试运行测试时,它们都失败了,并显示相同的错误消息:
Expecting a stackmap frame at branch target 65 in method xxx.xxxx.xxxx.xxxx;)V at offset 40我不知道为什么会发生这种情况,甚至不知道如何修复它。我在网上搜索过,但没有发现任何类似的问题。我使用JUnit和spring-test-mvc进行测试。
以前有没有人见过这个?
发布于 2013-08-06 23:42:51
当然,我在问完问题后就找到了答案,尽管我之前搜索了很长时间……
问题是,Cobertura在使用Java1.7时遇到了问题。您必须将以下行添加到pom.xml中:
<argLine>-XX:-UseSplitVerifier</argLine>它位于配置元素中。下面是整个Cobertura部分:
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>cobertura-maven-plugin</artifactId>
<version>2.5.1</version>
<configuration>
<argLine>-XX:-UseSplitVerifier</argLine>
<formats>
<format>xml</format>
</formats>
</configuration>
<executions>
<execution>
<phase>test</phase>
<goals>
<goal>cobertura</goal>
</goals>
</execution>
</executions>
</plugin>现在一切都像预期的那样工作了。
发布于 2017-02-10 04:33:14
已使用新插件修复
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>cobertura-maven-plugin</artifactId>
<version>2.7</version>
<configuration>
<formats>
<format>xml</format>
</formats>
</configuration>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>cobertura</goal>
</goals>
</execution>
</executions>
</plugin>https://stackoverflow.com/questions/18084436
复制相似问题