1

We are using gerrit trigger to build maven based projects in Jenkins.

My build goal is "clean install -e" and then Dmaven.test.skip=true in properties tab.

Command specified in the jenkins job's maven build section

clean install -e with this property -Dmaven.test.skip=true

Snapshopt of my build section

enter image description here

Strangely the build has started failing for a reverted commit with unknown lifecycle phase "for" error. But there is no "for" build phase is mentioned in the build configuration. It was passing before this reverted commit.

Console output

    [ERROR] Unknown lifecycle phase "for". You must specify a valid lifecycle phase or a goal in the format <plugin-prefix>:<goal> or <plugin-group-id>:<plugin-artifact-id>[:<plugin-version>]:<goal>. Available lifecycle phases are: validate, initialize, generate-sources, process-sources, generate-resources, process-resources, compile, process-classes, generate-test-sources, process-test-sources, generate-test-resources, process-test-resources, test-compile, process-test-classes, test, prepare-package, package, pre-integration-test, integration-test, post-integration-test, verify, install, deploy, pre-site, site, post-site, site-deploy, pre-clean, clean, post-clean. -> [Help 1]
org.apache.maven.lifecycle.LifecyclePhaseNotFoundException: Unknown lifecycle phase "for". You must specify a valid lifecycle phase or a goal in the format <plugin-prefix>:<goal> or <plugin-group-id>:<plugin-artifact-id>[:<plugin-version>]:<goal>. Available lifecycle phases are: validate, initialize, generate-sources, process-sources, generate-resources, process-resources, compile, process-classes, generate-test-sources, process-test-sources, generate-test-resources, process-test-resources, test-compile, process-test-classes, test, prepare-package, package, pre-integration-test, integration-test, post-integration-test, verify, install, deploy, pre-site, site, post-site, site-deploy, pre-clean, clean, post-clean.
    at org.apache.maven.lifecycle.internal.DefaultLifecycleExecutionPlanCalculator.calculateLifecycleMappings(DefaultLifecycleExecutionPlanCalculator.java:222)
    at org.apache.maven.lifecycle.internal.DefaultLifecycleExecutionPlanCalculator.calculateMojoExecutions(DefaultLifecycleExecutionPlanCalculator.java:193)
    at org.apache.maven.lifecycle.internal.DefaultLifecycleExecutionPlanCalculator.calculateExecutionPlan(DefaultLifecycleExecutionPlanCalculator.java:112)
    at org.apache.maven.lifecycle.internal.DefaultLifecycleExecutionPlanCalculator.calculateExecutionPlan(DefaultLifecycleExecutionPlanCalculator.java:129)
    at org.apache.maven.lifecycle.internal.BuilderCommon.resolveBuildPlan(BuilderCommon.java:92)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:81)
    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:320)
    at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:156)
    at org.apache.maven.cli.MavenCli.execute(MavenCli.java:537)
    at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:196)
    at org.apache.maven.cli.MavenCli.main(MavenCli.java:141)
    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:601)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:290)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:230)
    at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:409)
    at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:352)
[ERROR] 
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR] 
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/LifecyclePhaseNotFoundException

I am totally clueless here :(.

Best Regards, Saurav

saurav
  • 5,388
  • 10
  • 56
  • 101
  • Strange. What is the effective pom.xml used, and what is the command your run? Can you also provide the build output? – Pierre B. Nov 28 '17 at 12:10
  • thanks @PierreB. for the reply...i have added the necessary details...i am sure the pom.xml has not been changed – saurav Nov 28 '17 at 14:30
  • Thanks, can you provide the entire jenkins log? It seems you actually run a command like `mvn log` which gives you this error. Jenkins normally output in its log the actual command ran before its output. Also, the exact command configured in Jenkins job. – Pierre B. Nov 28 '17 at 14:46
  • can u add a screen shot from jenkins configuration (with the maven command)? just to make sure .... – OhadR Nov 28 '17 at 14:58
  • updated with screenshot...one more point..other colleagues changes are building fine with this build job..strangely mine is failing..but the log does not show any code related error as well as my local maven build is passing – saurav Nov 28 '17 at 15:11
  • very strange...i did the same changes manually and it is passing but when i was doing through git revert it is failing...does git revert affects gerrit/maven builds anyway ?...i guess not – saurav Nov 28 '17 at 16:20
  • Quite strange. Still, your entire Jenkins build log with the error may provide elements as why it happens (obfuscate sensible elements i any). You error can be easily reproduced when running `mvn for` on any project, the hard part is to understand why Jenkins does that – Pierre B. Nov 29 '17 at 09:05

1 Answers1

0

Please remove the clean install -e and place it as test and let me know

Ramesh Korla
  • 64
  • 2
  • 3
  • 8