Jenkins搭建的几个坑记下

坑一

安装cobertura插件后,一定要在工程代码的pom.xml文件里添加如下插件配置:

            <plugin>
                    <groupId>org.codehaus.mojo</groupId>
                    <artifactId>cobertura-maven-plugin</artifactId>
                    <version>2.2</version>
                    <configuration>
                        <formats>
                            <format>xml</format>
                        </formats>
                    </configuration>
                    <executions>
                        <execution>
                            <phase>package</phase>
                            <goals>
                                <goal>cobertura</goal>
                            </goals>
                        </execution>
                    </executions>
                </plugin>

官方原文说明如下

You can either, enable "cobertura" analysis in your 'pom.xml' files or just tell Jenkins to run "cobertura" goal.
If you don't want to change your pom files, just add the goal 'cobertura:cobertura' to your Maven project in Jenkins.

这个说法以我的英文水平理解,完全是坑啊,因为我只是在Jenkins里配置了"cobertura"goal,根本没有效啊。

坑二

在jdk7下运行的Jenkins,会报如下错:

java.lang.VerifyError: Expecting a stackmap frame at branch target 245
Exception Details:
  Location:
    xx.xx.xx.A.class()V @220: ifle
  Reason:
    Expected stackmap frame at this location.
  Bytecode:

原因就是这个cobertura对jdk7支持不友好,解决方法还是在你的工程pom.xml文件里配置如下:

             <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-plugin</artifactId>
                <version>2.12</version>
                <configuration>
                    <argLine>-XX:-UseSplitVerifier</argLine>
                </configuration>
            </plugin>

网上很多说在Jenkins的配置面板里配置“Global MAVEN_OPTS”的值为“-XX:-UseSplitVerifier”,根本是没有用的。原因可能是这里说的

posted @ 2015-05-28 21:22  海鸟  阅读(893)  评论(0编辑  收藏  举报