在 Jenkins 上查找错误

Findbugs on Jenkins

我正在尝试在 Jenkins 上配置 Finbugs。 我的应用程序版本:

在本地使用命令准备报告我没有任何问题:

mvn clean -D"dependency.locations.enabled=false" compile site

但不幸的是我在 jenkins 上遇到了问题:我的日志是:

  ERROR: Could not find local repository for 2.2.1
[FATAL ERROR] hudson.maven.agent.PluginManagerInterceptorMojoIntercepterImpl#configureComponent(...) caused a linkage error (java.lang.VerifyError) and may be out-of-date. Check the realms:
[FATAL ERROR] Plugin realm = app0.child-container[org.apache.cxf:cxf-codegen-plugin:2.3.2-fuse-00-00]
urls[0] = file:/var/fuse-base/apache-servicemix-4.3.1-devDD/project-repository/org/apache/cxf/cxf-codegen-plugin/2.3.2-fuse-00-00/cxf-codegen-plugin-2.3.2-fuse-00-00.jar
urls[1] = file:/var/fuse-base/apache-servicemix-4.3.1-devDD/project-repository/org/apache/maven/shared/maven-artifact-resolver/1.0/maven-artifact-resolver-1.0.jar
urls[2] = file:/var/fuse-base/apache-servicemix-4.3.1-devDD/project-repository/org/codehaus/plexus/plexus-utils/1.1/plexus-utils-1.1.jar
urls[3] = file:/var/fuse-base/apache-servicemix-4.3.1-devDD/project-repository/org/apache/cxf/cxf-tools-common/2.3.2-fuse-00-00/cxf-tools-common-2.3.2-fuse-00-00.jar
urls[4] = file:/var/fuse-base/apache-servicemix-4.3.1-devDD/project-repository/org/apache/velocity/velocity/1.6.4/velocity-1.6.4.jar
urls[5] = file:/var/fuse-base/apache-servicemix-4.3.1-devDD/project-repository/commons-collections/commons-collections/3.2.1/commons-collections-3.2.1.jar
urls[6] = file:/var/fuse-base/apache-servicemix-4.3.1-devDD/project-repository/commons-lang/commons-lang/2.5/commons-lang-2.5.jar
urls[7] = file:/var/fuse-base/apache-servicemix-4.3.1-devDD/project-repository/oro/oro/2.0.8/oro-2.0.8.jar
urls[8] = file:/var/fuse-base/apache-servicemix-4.3.1-devDD/project-repository/wsdl4j/wsdl4j/1.6.2/wsdl4j-1.6.2.jar
urls[9] = file:/var/fuse-base/apache-servicemix-4.3.1-devDD/project-repository/com/sun/xml/bind/jaxb-xjc/2.1.13/jaxb-xjc-2.1.13.jar
urls[10] = file:/var/fuse-base/apache-servicemix-4.3.1-devDD/project-repository/com/sun/xml/bind/jaxb-impl/2.1.13/jaxb-impl-2.1.13.jar
urls[11] = file:/var/fuse-base/apache-servicemix-4.3.1-devDD/project-repository/org/apache/cxf/cxf-api/2.3.2-fuse-00-00/cxf-api-2.3.2-fuse-00-00.jar
urls[12] = file:/var/fuse-base/apache-servicemix-4.3.1-devDD/project-repository/org/apache/cxf/cxf-common-utilities/2.3.2-fuse-00-00/cxf-common-utilities-2.3.2-fuse-00-00.jar
urls[13] = file:/var/fuse-base/apache-servicemix-4.3.1-devDD/project-repository/org/apache/ws/commons/schema/XmlSchema/1.4.7/XmlSchema-1.4.7.jar
urls[14] = file:/var/fuse-base/apache-servicemix-4.3.1-devDD/project-repository/org/codehaus/woodstox/woodstox-core-asl/4.0.8/woodstox-core-asl-4.0.8.jar
urls[15] = file:/var/fuse-base/apache-servicemix-4.3.1-devDD/project-repository/org/codehaus/woodstox/stax2-api/3.0.2/stax2-api-3.0.2.jar
urls[16] = file:/var/fuse-base/apache-servicemix-4.3.1-devDD/project-repository/org/apache/neethi/neethi/2.0.4/neethi-2.0.4.jar
urls[17] = file:/var/fuse-base/apache-servicemix-4.3.1-devDD/project-repository/commons-logging/commons-logging/1.1.1/commons-logging-1.1.1.jar
urls[18] = file:/var/fuse-base/apache-servicemix-4.3.1-devDD/project-repository/org/apache/cxf/cxf-common-schemas/2.3.2-fuse-00-00/cxf-common-schemas-2.3.2-fuse-00-00.jar
urls[19] = file:/var/fuse-base/apache-servicemix-4.3.1-devDD/project-repository/org/apache/cxf/cxf-rt-core/2.3.2-fuse-00-00/cxf-rt-core-2.3.2-fuse-00-00.jar
urls[20] = file:/var/fuse-base/apache-servicemix-4.3.1-devDD/project-repository/org/apache/geronimo/specs/geronimo-javamail_1.4_spec/1.7.1/geronimo-javamail_1.4_spec-1.7.1.jar
urls[21] = file:/var/fuse-base/apache-servicemix-4.3.1-devDD/project-repository/org/apache/cxf/cxf-tools-wsdlto-core/2.3.2-fuse-00-00/cxf-tools-wsdlto-core-2.3.2-fuse-00-00.jar
urls[22] = file:/var/fuse-base/apache-servicemix-4.3.1-devDD/project-repository/org/apache/cxf/cxf-tools-validator/2.3.2-fuse-00-00/cxf-tools-validator-2.3.2-fuse-00-00.jar
urls[23] = file:/var/fuse-base/apache-servicemix-4.3.1-devDD/project-repository/org/apache/cxf/cxf-tools-wsdlto-databinding-jaxb/2.3.2-fuse-00-00/cxf-tools-wsdlto-databinding-jaxb-2.3.2-fuse-00-00.jar
urls[24] = file:/var/fuse-base/apache-servicemix-4.3.1-devDD/project-repository/org/apache/cxf/cxf-tools-wsdlto-frontend-jaxws/2.3.2-fuse-00-00/cxf-tools-wsdlto-frontend-jaxws-2.3.2-fuse-00-00.jar
urls[25] = file:/var/fuse-base/apache-servicemix-4.3.1-devDD/project-repository/xml-resolver/xml-resolver/1.2/xml-resolver-1.2.jar
urls[26] = file:/var/fuse-base/apache-servicemix-4.3.1-devDD/project-repository/org/springframework/spring-core/3.0.5.RELEASE/spring-core-3.0.5.RELEASE.jar
urls[27] = file:/var/fuse-base/apache-servicemix-4.3.1-devDD/project-repository/org/springframework/spring-asm/3.0.5.RELEASE/spring-asm-3.0.5.RELEASE.jar
urls[28] = file:/var/fuse-base/apache-servicemix-4.3.1-devDD/project-repository/org/springframework/spring-beans/3.0.5.RELEASE/spring-beans-3.0.5.RELEASE.jar
urls[29] = file:/var/fuse-base/apache-servicemix-4.3.1-devDD/project-repository/org/springframework/spring-context/3.0.5.RELEASE/spring-context-3.0.5.RELEASE.jar
urls[30] = file:/var/fuse-base/apache-servicemix-4.3.1-devDD/project-repository/org/springframework/spring-aop/3.0.5.RELEASE/spring-aop-3.0.5.RELEASE.jar
urls[31] = file:/var/fuse-base/apache-servicemix-4.3.1-devDD/project-repository/aopalliance/aopalliance/1.0/aopalliance-1.0.jar
urls[32] = file:/var/fuse-base/apache-servicemix-4.3.1-devDD/project-repository/org/springframework/spring-expression/3.0.5.RELEASE/spring-expression-3.0.5.RELEASE.jar
urls[33] = file:/var/fuse-base/apache-servicemix-4.3.1-devDD/project-repository/org/apache/ant/ant/1.8.1/ant-1.8.1.jar
urls[34] = file:/var/fuse-base/apache-servicemix-4.3.1-devDD/project-repository/org/apache/ant/ant-launcher/1.8.1/ant-launcher-1.8.1.jar
urls[35] = file:/var/fuse-base/apache-servicemix-4.3.1-devDD/project-repository/org/apache/ant/ant-nodeps/1.8.1/ant-nodeps-1.8.1.jar
[FATAL ERROR] Container realm = plexus.core.maven
urls[0] = file:/var/fuse-base/apache-servicemix-4.3.1-devDD/project-repository/org/apache/maven/wagon/wagon-webdav-jackrabbit/1.0-beta-6/wagon-webdav-jackrabbit-1.0-beta-6.jar
urls[1] = file:/var/fuse-base/apache-servicemix-4.3.1-devDD/project-repository/org/apache/maven/wagon/wagon-http-shared/1.0-beta-6/wagon-http-shared-1.0-beta-6.jar
urls[2] = file:/var/fuse-base/apache-servicemix-4.3.1-devDD/project-repository/nekohtml/xercesMinimal/1.9.6.2/xercesMinimal-1.9.6.2.jar
urls[3] = file:/var/fuse-base/apache-servicemix-4.3.1-devDD/project-repository/nekohtml/nekohtml/1.9.6.2/nekohtml-1.9.6.2.jar
urls[4] = file:/var/fuse-base/apache-servicemix-4.3.1-devDD/project-repository/commons-httpclient/commons-httpclient/3.1/commons-httpclient-3.1.jar
urls[5] = file:/var/fuse-base/apache-servicemix-4.3.1-devDD/project-repository/commons-logging/commons-logging/1.0.4/commons-logging-1.0.4.jar
urls[6] = file:/var/fuse-base/apache-servicemix-4.3.1-devDD/project-repository/commons-codec/commons-codec/1.2/commons-codec-1.2.jar
urls[7] = file:/var/fuse-base/apache-servicemix-4.3.1-devDD/project-repository/org/codehaus/plexus/plexus-utils/1.1/plexus-utils-1.1.jar
urls[8] = file:/var/fuse-base/apache-servicemix-4.3.1-devDD/project-repository/org/apache/jackrabbit/jackrabbit-webdav/1.5.0/jackrabbit-webdav-1.5.0.jar
urls[9] = file:/var/fuse-base/apache-servicemix-4.3.1-devDD/project-repository/org/apache/jackrabbit/jackrabbit-jcr-commons/1.5.0/jackrabbit-jcr-commons-1.5.0.jar
urls[10] = file:/var/fuse-base/apache-servicemix-4.3.1-devDD/project-repository/org/slf4j/slf4j-api/1.5.3/slf4j-api-1.5.3.jar
urls[11] = file:/var/fuse-base/apache-servicemix-4.3.1-devDD/project-repository/org/slf4j/slf4j-nop/1.5.3/slf4j-nop-1.5.3.jar
ERROR: Could not find local repository for 2.2.1
[INFO] ------------------------------------------------------------------------
[ERROR] FATAL ERROR
[INFO] ------------------------------------------------------------------------
[INFO] Bad type on operand stack
Exception Details:
  Location:
    org/apache/commons/codec/binary/Base64OutputStream.<init>(Ljava/io/OutputStream;Z)V @11: invokespecial
  Reason:
    Type 'org/apache/commons/codec/binary/Base64' (current frame, stack[2]) is not assignable to 'org/apache/commons/codec/binary/BaseNCodec'
  Current Frame:
    bci: @11
    flags: { flagThisUninit }
    locals: { uninitializedThis, 'java/io/OutputStream', integer }
    stack: { uninitializedThis, 'java/io/OutputStream', 'org/apache/commons/codec/binary/Base64', integer }
  Bytecode:
    0000000: 2a2b bb00 0259 03b7 0003 1cb7 0004 b1  

[INFO] ------------------------------------------------------------------------
[INFO] Trace
java.lang.VerifyError: Bad type on operand stack
Exception Details:
  Location:
    org/apache/commons/codec/binary/Base64OutputStream.<init>(Ljava/io/OutputStream;Z)V @11: invokespecial
  Reason:
    Type 'org/apache/commons/codec/binary/Base64' (current frame, stack[2]) is not assignable to 'org/apache/commons/codec/binary/BaseNCodec'
  Current Frame:
    bci: @11
    flags: { flagThisUninit }
    locals: { uninitializedThis, 'java/io/OutputStream', integer }
    stack: { uninitializedThis, 'java/io/OutputStream', 'org/apache/commons/codec/binary/Base64', integer }
  Bytecode:
    0000000: 2a2b bb00 0259 03b7 0003 1cb7 0004 b1  

    at hudson.console.ConsoleNote.encodeToBytes(ConsoleNote.java:182)
    at hudson.console.ConsoleNote.encodeTo(ConsoleNote.java:157)
    at hudson.util.StreamTaskListener.annotate(StreamTaskListener.java:159)
    at hudson.util.StreamTaskListener._error(StreamTaskListener.java:134)
    at hudson.util.StreamTaskListener.error(StreamTaskListener.java:143)
    at hudson.maven.reporters.MavenFingerprinter.recordParents(MavenFingerprinter.java:144)
    at hudson.maven.reporters.MavenFingerprinter.postBuild(MavenFingerprinter.java:110)
    at hudson.maven.Maven2Builder.postModule(Maven2Builder.java:129)
    at hudson.maven.MavenBuilder$Adapter.fireLeaveModule(MavenBuilder.java:353)
    at hudson.maven.MavenBuilder$Adapter.postBuild(MavenBuilder.java:307)
    at org.apache.maven.lifecycle.LifecycleExecutorInterceptor.execute(LifecycleExecutorInterceptor.java:68)
    at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:328)
    at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:138)
    at org.apache.maven.cli.MavenCli.main(MavenCli.java:362)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:606)
    at org.codehaus.classworlds.Launcher.launchEnhanced(Launcher.java:315)
    at org.codehaus.classworlds.Launcher.launch(Launcher.java:255)
    at hudson.maven.agent.Main.launch(Main.java:205)
    at hudson.maven.MavenBuilder.call(MavenBuilder.java:154)
    at hudson.maven.Maven2Builder.call(Maven2Builder.java:79)
    at hudson.maven.Maven2Builder.call(Maven2Builder.java:55)
    at hudson.remoting.UserRequest.perform(UserRequest.java:121)
    at hudson.remoting.UserRequest.perform(UserRequest.java:49)
    at hudson.remoting.Request.run(Request.java:326)
    at hudson.remoting.InterceptingExecutorService.call(InterceptingExecutorService.java:68)
    at java.util.concurrent.FutureTask.run(FutureTask.java:262)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
    at java.lang.Thread.run(Thread.java:745)

我的pom.xml:

  ...
        <findbugs.version>2.5.3</findbugs.version>
    ...
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-compiler-plugin</artifactId>
                    <version>2.5.1</version>
                    <configuration>
                        <encoding>UTF-8</encoding>
                        <source>1.6</source>
                        <target>1.6</target>
                    </configuration>
                </plugin>
                        <plugin>
                            <groupId>org.apache.maven.plugins</groupId>
                            <artifactId>maven-pmd-plugin</artifactId>
                            <configuration>
                                <linkXref>true</linkXref>
                                <sourceEncoding>UTF-8</sourceEncoding>
                                <minimumTokens>30</minimumTokens>
                                <targetJdk>1.6</targetJdk>
                            </configuration>
                        </plugin>
                        <plugin>
                           <groupId>org.codehaus.mojo</groupId>
                           <artifactId>findbugs-maven-plugin</artifactId>
                           <version>${findbugs.version}</version>
                        </plugin>
                    </plugins>
                </pluginManagement>
            </build>
          <reporting>
             <plugins>
                <plugin>
                   <groupId>org.apache.maven.plugins</groupId>
                   <artifactId>maven-surefire-report-plugin</artifactId>
                   <version>${surefire.reportplugin.version}</version>
                </plugin>
                <plugin>
                   <groupId>org.codehaus.mojo</groupId>
                   <artifactId>findbugs-maven-plugin</artifactId>
                   <version>${findbugs.version}</version>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-pmd-plugin</artifactId>
                </plugin>
              </plugins>
           </reporting>

更新: 我有 mvn 插件版本:2.11 那是我的配置:

和我的外部 mvn,它在 /usr/local/maven 内部具有以下配置:

<localRepository>my_local_repo</localRepository>

<proxies>
        <proxy>
                <id>optional</id>
                <active>true</active>
                <protocol>http</protocol>
                <host>my.host</host>
                <port>3128</port>
                <nonProxyHosts>custom.com.pl</nonProxyHosts>
        </proxy>
  </proxies>

我在 maven 3.2.3 上遇到了类似的问题,我发现 jenkins 想要设置 jenkins.localRepository,我不知道你的确切设置,但我相信它需要指出M2不知何故。我看到以下使用

-Dmaven.repo.local="$path_to_m2"

但您的情况可能是:

-Djenkins.localRepository="$path_to_m2"

将 maven 项目配置更新为:

  • 执行者本地
  • 工作地点space

您也可以尝试解决此问题:

  • 而不是手动提供本地 maven 安装。使用安装 在 Maven 安装中自动进行,Jenkins 将负责所有工作 这个问题。

最后我决定使用 execute shell 命令:

cd $WORKSPACE
rm -rf target
mvn clean -D"dependency.locations.enabled=false" compile site -e -X

现在我的堆栈是,但它看起来是 jenkins 用户权限的问题,所以我想我可以处理它。

[DEBUG] Trace
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to generate types.
    at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java:719)
    at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalWithLifecycle(DefaultLifecycleExecutor.java:556)
    at org.apache.maven.lifecycle.DefaultLifecycleExecutor.forkProjectLifecycle(DefaultLifecycleExecutor.java:1205)
    at org.apache.maven.lifecycle.DefaultLifecycleExecutor.forkLifecycle(DefaultLifecycleExecutor.java:1033)
    at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java:663)
    at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalWithLifecycle(DefaultLifecycleExecutor.java:556)
    at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoal(DefaultLifecycleExecutor.java:535)
    at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalAndHandleFailures(DefaultLifecycleExecutor.java:387)
    at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeTaskSegments(DefaultLifecycleExecutor.java:348)
    at org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(DefaultLifecycleExecutor.java:180)
    at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:328)
    at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:138)
    at org.apache.maven.cli.MavenCli.main(MavenCli.java:362)
    at org.apache.maven.cli.compat.CompatibleMain.main(CompatibleMain.java:60)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at org.codehaus.classworlds.Launcher.launchEnhanced(Launcher.java:315)
    at org.codehaus.classworlds.Launcher.launch(Launcher.java:255)
    at org.codehaus.classworlds.Launcher.mainWithExitCode(Launcher.java:430)
    at org.codehaus.classworlds.Launcher.main(Launcher.java:375)
Caused by: org.apache.maven.plugin.MojoExecutionException: Failed to generate types.
    at org.apache.cxf.maven_plugin.WSDL2JavaMojo.callWsdl2Java(WSDL2JavaMojo.java:413)
    at org.apache.cxf.maven_plugin.WSDL2JavaMojo.execute(WSDL2JavaMojo.java:362)
    at org.apache.maven.plugin.DefaultPluginManager.executeMojo(DefaultPluginManager.java:490)
    at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java:694)
    ... 21 more
Caused by: org.apache.cxf.tools.common.ToolException: Failed to generate types.
    at org.apache.cxf.tools.wsdlto.databinding.jaxb.JAXBDataBinding.generate(JAXBDataBinding.java:745)
    at org.apache.cxf.tools.wsdlto.WSDLToJavaContainer.generateTypes(WSDLToJavaContainer.java:586)
    at org.apache.cxf.tools.wsdlto.WSDLToJavaContainer.processWsdl(WSDLToJavaContainer.java:237)
    at org.apache.cxf.tools.wsdlto.WSDLToJavaContainer.execute(WSDLToJavaContainer.java:137)
    at org.apache.cxf.tools.wsdlto.WSDLToJavaContainer.execute(WSDLToJavaContainer.java:280)
    at org.apache.cxf.tools.common.toolspec.ToolRunner.runTool(ToolRunner.java:103)
    at org.apache.cxf.tools.wsdlto.WSDLToJava.run(WSDLToJava.java:113)
    at org.apache.cxf.tools.wsdlto.WSDLToJava.run(WSDLToJava.java:86)
    at org.apache.cxf.maven_plugin.WSDL2JavaMojo.callWsdl2Java(WSDL2JavaMojo.java:410)
    ... 24 more

我还更改了 maven 插件以使用:

maven opts: -Dmaven.repo.local=my-repo-directory

我已经检查使用私有 Maven 存储库策略:执行者本地