Unit tests passing through Maven, but failing through Cobertura: “Expecting a stackmap frame at branch target 65”

∥☆過路亽.° 提交于 2019-12-03 09:59:14

Of course I find the answer right after asking the question, even though I searched for quite awhile before...

The problem is that Cobertura has trouble working with Java 1.7. You must add the following line to your pom.xml:

<argLine>-XX:-UseSplitVerifier</argLine>

That goes in the configuration element. Here is the entire Cobertura section:

     <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>

Now everything works as expected.

Fixed by using new plugin

                  <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>
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!