How can I tell jenkins I do want the full error tr

2019-06-16 07:16发布

问题:

Running a maven job in jenkins fails with that console output: 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

And every log file found on workspace ends the same way.

But running

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

from a prompt, inside

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

outputs a full error trace with the compilation errors that can help to solve the problem:

(...)
[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] ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
(...)

How can I tell jenkins I do want that error trace?

回答1:

mvn --help lists down options you can use with mvn command.

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

Should you not be using maven with -e option to track down errors in jenkins job configuration.



回答2:

Just add -X option to the Maven command line in the Jenkins configuration. But be aware that the output can be very long.



回答3:

I could be way off base here, but it looks like

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

is cuasing an error, either because you have a null reference, or because the library that the class comes from wasn't marked properly as a dependancy.



回答4:

for this there are two possible ways to find out where your problem is:

  1. add -Xdebug to your MAVEN_OPTS set MAVEN_OPTS=-Xmx1024m -Xms1024m -Xdebug call mvn clean install
  2. Or look for the failure via remote debugging. For this add the "maven-compiler-plugin" to one of your eclipse projects and start the maven build on your broken project with set MAVEN_OPTS=-Xmx1024m -Xms1024m -Xdebug -XX:PermSize=256m -Xrunjdwp:transport=dt_socket,address=4000,server=y,suspend=y call mvn install Than start a remote debug session in eclipse and add a "error" brake point to "CompilationFailureException" this will figure out your problem immediately.

Wish you much luck for it