我怎么能告诉jenkins我确实想要maven工作的完整错误跟踪?

时间:2012-03-27 15:52:03

标签: maven compiler-errors jenkins maven-3

在jenkins中运行maven作业失败并显示该控制台输出:Finished: FAILURE

[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 2:52.431s
[INFO] Finished at: Tue Mar 27 17:17:54 CEST 2012
[INFO] Final Memory: 69M/145M
[INFO] ------------------------------------------------------------------------
mavenExecutionResult exceptions not empty
message : Failed to execute goal org.eclipse.tycho:tycho-compiler-plugin:0.14.1:compile (default-compile) on project com.visualligence.g: Compilation failure
cause : Compilation failure
Stack trace : 
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.eclipse.tycho:tycho-compiler-plugin:0.14.1:compile (default-compile) on project com.visualligence.g: Compilation failure
        at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:213)
        at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
        at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
        at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:84)
        at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:59)
        at org.apache.maven.lifecycle.internal.LifecycleStarter.singleThreadedBuild(LifecycleStarter.java:183)
        at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:161)
        at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:319)
        at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:156)
        at org.jvnet.hudson.maven3.launcher.Maven3Launcher.main(Maven3Launcher.java:79)
        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.plexus.classworlds.launcher.Launcher.launchStandard(Launcher.java:329)
        at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:239)
        at org.jvnet.hudson.maven3.agent.Maven3Main.launch(Maven3Main.java:158)
        at hudson.maven.Maven3Builder.call(Maven3Builder.java:104)
        at hudson.maven.Maven3Builder.call(Maven3Builder.java:70)
        at hudson.remoting.UserRequest.perform(UserRequest.java:118)
        at hudson.remoting.UserRequest.perform(UserRequest.java:48)
        at hudson.remoting.Request$2.run(Request.java:287)
        at hudson.remoting.InterceptingExecutorService$1.call(InterceptingExecutorService.java:72)
        at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
        at java.util.concurrent.FutureTask.run(FutureTask.java:138)
        at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
        at java.lang.Thread.run(Thread.java:662)
Caused by: copied.org.apache.maven.plugin.CompilationFailureException: Compilation failure
        at copied.org.apache.maven.plugin.AbstractCompilerMojo.execute(AbstractCompilerMojo.java:409)
        at org.eclipse.tycho.compiler.AbstractOsgiCompilerMojo.execute(AbstractOsgiCompilerMojo.java:179)
        at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:101)
        at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:209)
        ... 27 more
channel stopped
Finished: FAILURE

在工作区找到的每个日志文件都以相同的方式结束。

但是正在运行

../../../tools/maven/bin/mvn install

来自提示,

/var/lib/jenkins/jobs/visualligence/workspace

输出完整的错误跟踪,其中包含有助于解决问题的编译错误:

(...)
[INFO] Compiling 10 source files to /var/lib/jenkins/jobs/visualligence/workspace/target/classes
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 2:47.960s
[INFO] Finished at: Tue Mar 27 17:39:27 CEST 2012
[INFO] Final Memory: 65M/169M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.eclipse.tycho:tycho-compiler-plugin:0.14.1:compile (default-compile) on project com.visualligence.g: Compilation failure: Compilation failure:
[ERROR] /var/lib/jenkins/jobs/visualligence/workspace/src/com/visualligence/g/generator/Main.java:[30,0]
[ERROR] Injector injector = new com.visualligence.g.VMLStandaloneSetupGenerated().createInjectorAndDoEMFRegistration();
[ERROR] ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
(...)

如何告诉jenkins我确实想要错误跟踪?

4 个答案:

答案 0 :(得分:14)

mvn --help 列出了可以与mvn命令一起使用的向下选项。

-e,--errors     Produce execution error messages
-X,--debug      Produce execution debug output 
-q,--quiet      Quiet output - only show errors

您是否应该使用 maven with -e 选项来追踪jenkins作业配置中的错误。

enter image description here

答案 1 :(得分:3)

只需在Jenkins配置中的Maven命令行中添加-X选项即可。但要注意输出可能很长。

答案 2 :(得分:1)

我可能会离开这里,但它看起来像

Injector injector = new com.visualligence.g.VMLStandaloneSetupGenerated().createInjectorAndDoEMFRegistration();

是因为你有一个空引用,或者因为这个类所来自的库没有被正确标记为依赖而引发错误。

答案 3 :(得分:1)

为此,有两种方法可以找出问题所在:

  1. 将-Xdebug添加到您的MAVEN_OPTS set MAVEN_OPTS=-Xmx1024m -Xms1024m -Xdebug call mvn clean install
  2. 或通过远程调试查找失败。为此,将“maven-compiler-plugin”添加到您的某个eclipse项目中,并使用 set MAVEN_OPTS=-Xmx1024m -Xms1024m -Xdebug -XX:PermSize=256m -Xrunjdwp:transport=dt_socket,address=4000,server=y,suspend=y call mvn install在您的破坏项目上启动maven构建,然后在eclipse中启动远程调试会话,并向“错误”制动点添加“ CompilationFailureException“这将立即找出你的问题。
  3. 祝你好运