You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@maven.apache.org by "Thorsten Heit (Jira)" <ji...@apache.org> on 2022/11/22 10:06:00 UTC

[jira] [Created] (MRELEASE-1110) release:prepare fails on Jenkins agent with " 'cmd' is not recognized as an internal or external command"

Thorsten Heit created MRELEASE-1110:
---------------------------------------

             Summary: release:prepare fails on Jenkins agent with " 'cmd' is not recognized as an internal or external command"
                 Key: MRELEASE-1110
                 URL: https://issues.apache.org/jira/browse/MRELEASE-1110
             Project: Maven Release Plugin
          Issue Type: Bug
          Components: prepare
    Affects Versions: 3.0.0-M7, 3.0.0-M6
            Reporter: Thorsten Heit


We have a project that is configured as a Maven project in Jenkins and is built by a Jenkins agent running on a Windows machine. Using "clean verify" as goals I can build the project successfully. So far, so good.

Changing this to "-B -DdevelopmentVersion=1.3.1-SNAPSHOT -DreleaseVersion=1.3.0 -Dresume=false -DdryRun=true -DautoResolveSnapshots=all release:prepare", the build fails:
{noformat}
(...)
[EasyMailServer] $ D:\Build\Tools\Java\JDKs\jdk1.8.0/bin/java -Dorg.apache.maven.global-settings=C:\Users\continteg\.m2\settings.xml -Djava.awt.headless=true -cp d:\.j\maven35-agent.jar;D:\Build\Tools\Java\maven\apache-maven-3.8.3\boot\plexus-classworlds-2.6.0.jar;D:\Build\Tools\Java\maven\apache-maven-3.8.3/conf/logging jenkins.maven3.agent.Maven35Main D:\Build\Tools\Java\maven\apache-maven-3.8.3 D:\Build\Tools\jenkins-agent\agent.jar d:\.j\maven35-interceptor.jar d:\.j\maven3-interceptor-commons.jar 53433
<===[JENKINS REMOTING CAPACITY]===>channel started
Executing Maven:  -B -f d:\.j\workspace\EasyMailServer\pom.xml -DdevelopmentVersion=1.3.1-SNAPSHOT -DreleaseVersion=1.3.0 -Dresume=false -DdryRun=true -DautoResolveSnapshots=all release:prepare verify
[INFO] Scanning for projects...
(...)
[INFO] starting prepare goal in dry-run mode, composed of 17 phases: check-poms, scm-check-modifications, check-dependency-snapshots, create-backup-poms, map-release-versions, input-variables, map-development-versions, rewrite-poms-for-release, generate-release-poms, run-preparation-goals, scm-commit-release, scm-tag, rewrite-poms-for-development, remove-release-poms, run-completion-goals, scm-commit-development, end-release
[INFO] 1/17 prepare:check-poms dry-run
(...)
[INFO] 10/17 prepare:run-preparation-goals dry-run
[INFO] Executing preparation goals - since this is simulation mode it is running against the original project, not the rewritten ones
[INFO] Executing goals 'clean verify'...
[INFO]     with additional arguments: -P override_defaults,signing,jdks,infport,sonarqubevariables
[INFO] [INFO] Scanning for projects...
(...)
[INFO] [INFO] ------------------------------------------------------------------------
[INFO] [INFO] BUILD SUCCESS
[INFO] [INFO] ------------------------------------------------------------------------
[INFO] [INFO] Total time:  4.782 s
[INFO] [INFO] Finished at: 2022-11-22T09:52:03+01:00
[INFO] [INFO] ------------------------------------------------------------------------
[ERROR] 'cmd' is not recognized as an internal or external command,
[ERROR] operable program or batch file.
[JENKINS] Archiving disabled
[INFO] 
[INFO] ------------------------------------------------------------------------
[INFO] Skipping easyMailServer
[INFO] This project has been banned from the build due to previous failures.
[INFO] ------------------------------------------------------------------------
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  8.628 s
[JENKINS] Archiving disabled[INFO] Finished at: 2022-11-22T09:52:03+01:00
[INFO] ------------------------------------------------------------------------

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-release-plugin:3.0.0-M6:prepare (default-cli) on project easyMailServer: Maven execution failed, exit code: 1 -> [Help 1]
[ERROR] 
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[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/MojoExecutionException
{noformat}
(...)

The same error occurs with m-release-3.0.0-M7 (stacktrace turned on by additionally using "-X" in the goals):
{noformat}
(...)
[INFO] [INFO] ------------------------------------------------------------------------
[INFO] [INFO] BUILD SUCCESS
[INFO] [INFO] ------------------------------------------------------------------------
[INFO] [INFO] Total time:  5.207 s
[INFO] [INFO] Finished at: 2022-11-22T06:11:33+01:00
[INFO] [INFO] ------------------------------------------------------------------------
[ERROR] 'cmd' is not recognized as an internal or external command,
[ERROR] operable program or batch file.
[JENKINS] Archiving disabled
[INFO] 
[INFO] ------------------------------------------------------------------------
[INFO] Skipping easyMailServer
[INFO] This project has been banned from the build due to previous failures.
[INFO] ------------------------------------------------------------------------
[JENKINS] Archiving disabled
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  7.543 s
[INFO] Finished at: 2022-11-22T06:11:33+01:00
[INFO] ------------------------------------------------------------------------
Waiting for Jenkins to finish collecting data
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-release-plugin:3.0.0-M7:prepare (default-cli) on project easyMailServer: Maven execution failed, exit code: 1 -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.apache.maven.plugins:maven-release-plugin:3.0.0-M7:prepare (default-cli) on project easyMailServer: Maven execution failed, exit code: 1
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:215)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:156)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:148)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:117)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:81)
    at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build (SingleThreadedBuilder.java:56)
    at org.apache.maven.lifecycle.internal.LifecycleStarter.execute (LifecycleStarter.java:128)
    at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:305)
(...)
Caused by: org.apache.maven.plugin.MojoExecutionException: Maven execution failed, exit code: 1
    at org.apache.maven.plugins.release.PrepareReleaseMojo.prepareRelease (PrepareReleaseMojo.java:417)
    at org.apache.maven.plugins.release.PrepareReleaseMojo.execute (PrepareReleaseMojo.java:349)
    at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo (DefaultBuildPluginManager.java:137)
(...)
Caused by: org.apache.maven.shared.release.ReleaseExecutionException: Maven execution failed, exit code: 1
    at org.apache.maven.shared.release.phase.AbstractRunGoalsPhase.execute (AbstractRunGoalsPhase.java:112)
    at org.apache.maven.shared.release.phase.AbstractRunGoalsPhase.execute (AbstractRunGoalsPhase.java:60)
    at org.apache.maven.shared.release.phase.RunPrepareGoalsPhase.simulate (RunPrepareGoalsPhase.java:70)
    at org.apache.maven.shared.release.DefaultReleaseManager.prepare (DefaultReleaseManager.java:220)
    at org.apache.maven.shared.release.DefaultReleaseManager.prepare (DefaultReleaseManager.java:122)
(...)
Caused by: org.apache.maven.shared.release.exec.MavenExecutorException: Maven execution failed, exit code: 1
    at org.apache.maven.shared.release.exec.InvokerMavenExecutor.executeGoals (InvokerMavenExecutor.java:133)
    at org.apache.maven.shared.release.exec.AbstractMavenExecutor.executeGoals (AbstractMavenExecutor.java:71)
    at org.apache.maven.shared.release.phase.AbstractRunGoalsPhase.execute (AbstractRunGoalsPhase.java:105)
    at org.apache.maven.shared.release.phase.AbstractRunGoalsPhase.execute (AbstractRunGoalsPhase.java:60)
    at org.apache.maven.shared.release.phase.RunPrepareGoalsPhase.simulate (RunPrepareGoalsPhase.java:70)
    at org.apache.maven.shared.release.DefaultReleaseManager.prepare (DefaultReleaseManager.java:220)
(...)
[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/MojoExecutionException
{noformat}
What puzzles me is that the release prepare part itself seems to work fine ("{{[INFO] [INFO] BUILD SUCCESS}}"), but then complains that it couldn't find 'cmd' and fails the build. Obviously the reason is "Maven execution failed, exit code: 1" as received by the executed command-line (as far as I understand the source code of m-release-p), but why?

I have tried executing the same job with AdoptOpenJDK 8 (8u252) and Eclipse Adoptium 17.0.4, but the result stays the same.

However, when using m-release-p-3.0.0-M5, the same steps work:
{noformat}
[EasyMailServer] $ D:\Build\Tools\Java\JDKs\jdk1.8.0/bin/java -Dorg.apache.maven.global-settings=C:\Users\continteg\.m2\settings.xml -Djava.awt.headless=true -cp d:\.j\maven35-agent.jar;D:\Build\Tools\Java\maven\apache-maven-3.8.3\boot\plexus-classworlds-2.6.0.jar;D:\Build\Tools\Java\maven\apache-maven-3.8.3/conf/logging jenkins.maven3.agent.Maven35Main D:\Build\Tools\Java\maven\apache-maven-3.8.3 D:\Build\Tools\jenkins-agent\agent.jar d:\.j\maven35-interceptor.jar d:\.j\maven3-interceptor-commons.jar 53411
<===[JENKINS REMOTING CAPACITY]===>channel started
Executing Maven:  -B -f d:\.j\workspace\EasyMailServer\pom.xml -DdevelopmentVersion=1.3.1-SNAPSHOT -DreleaseVersion=1.3.0 -Dresume=false -DdryRun=true -DautoResolveSnapshots=all release:prepare verify
[INFO] Scanning for projects...
(...)
[INFO] starting prepare goal in dry-run mode, composed of 17 phases: check-poms, scm-check-modifications, check-dependency-snapshots, create-backup-poms, map-release-versions, input-variables, map-development-versions, rewrite-poms-for-release, generate-release-poms, run-preparation-goals, scm-commit-release, scm-tag, rewrite-poms-for-development, remove-release-poms, run-completion-goals, scm-commit-development, end-release
[INFO] [prepare dry-run] 1/17 check-poms
(...)
[INFO] [prepare dry-run] 10/17 run-preparation-goals
[INFO] Executing preparation goals - since this is simulation mode it is running against the original project, not the rewritten ones
[INFO] Executing goals 'clean verify'...
[INFO] [INFO] Scanning for projects...
(...)
[INFO] [INFO] ------------------------------------------------------------------------
[INFO] [INFO] BUILD SUCCESS
[INFO] [INFO] ------------------------------------------------------------------------
[INFO] [INFO] Total time:  6.534 s
[INFO] [INFO] Finished at: 2022-11-22T09:43:50+01:00
[INFO] [INFO] ------------------------------------------------------------------------
[INFO] [prepare dry-run] 11/17 scm-commit-release
[INFO] Full run would be commit 1 files with message: '[maven-release-plugin] prepare release 1.3.0'
(...)
[INFO] [prepare dry-run] 17/17 end-release
[INFO] Release preparation simulation complete.
[JENKINS] Archiving disabled
[INFO] 
(...)
{noformat}
Executing the same command line directly on my machine (Windows 10 x64) ("{{mvn release:prepare -DdryRun}}") works flawlessly, independent of the version of m-release-p I'm using...



--
This message was sent by Atlassian Jira
(v8.20.10#820010)