aleksandr-m / gitflow-maven-plugin

The Git-Flow Maven Plugin supports various Git workflows, including GitFlow and GitHub Flow. This plugin runs Git and Maven commands from the command line.
https://aleksandr-m.github.io/gitflow-maven-plugin/
Apache License 2.0
490 stars 182 forks source link

hotfix-start from support branch: unexpected hotfix branch #273

Closed puce77 closed 3 years ago

puce77 commented 3 years ago

When I execute the following command (via Jenkinsfile):

mvn -e -B -Dmaven.test.failure.ignore=true -DperformRelease=true gitflow:hotfix-start -DfromBranch=support/release-3.x -DhotfixVersion=3.4.0

This results in the following output:

[INFO] --- gitflow-maven-plugin:1.14.0:hotfix-start (default-cli) @ my-project ---
[INFO] Checking for uncommitted changes.
[INFO] Checking out 'support/release-3.x' branch.
[INFO] Fetching remote branch 'origin support/release-3.x'.
[INFO] Comparing local branch 'support/release-3.x' with remote 'origin/support/release-3.x'.
[INFO] Creating a new branch 'hotfix/support/release-3.x/3.4.0' from 'support/release-3.x' and checking it out.
[INFO] Updating version(s) to '3.4.0'.
[INFO] Committing changes.
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] --------------------

As you can see, the plugin creates for some reason the branch hotfix/support/release-3.x/3.4.0 instead of hotfix/3.4.0.

Afterwards when I execute the following command: mvn -e -B -Dmaven.test.failure.ignore=true -DperformRelease=true gitflow:hotfix-finish -DhotfixVersion=3.4.0 -DpostHotfixGoals="deploy -e -B -Dmaven.test.failure.ignore=true -DperformRelease=true -Dverbose=true"

I get the following error message:

[INFO] 
[INFO] --- gitflow-maven-plugin:1.14.0:hotfix-finish (default-cli) @ my-project ---
[INFO] Checking for uncommitted changes.
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  1.721 s
[INFO] Finished at: 2021-01-03T14:06:38+01:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal com.amashchenko.maven.plugin:gitflow-maven-plugin:1.14.0:hotfix-finish (default-cli) on project my-project: hotfix-finish: Hotfix branch with name 'hotfix/3.4.0' doesn't exist. Cannot finish hotfix. -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal com.amashchenko.maven.plugin:gitflow-maven-plugin:1.14.0:hotfix-finish (default-cli) on project my-project: hotfix-finish
    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)
    at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:192)
    at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:105)
    at org.apache.maven.cli.MavenCli.execute (MavenCli.java:957)
    at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:289)
    at org.apache.maven.cli.MavenCli.main (MavenCli.java:193)
    at sun.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke (Method.java:498)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced (Launcher.java:282)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launch (Launcher.java:225)
    at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode (Launcher.java:406)
    at org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java:347)
Caused by: org.apache.maven.plugin.MojoFailureException: hotfix-finish
    at com.amashchenko.maven.plugin.gitflow.GitFlowHotfixFinishMojo.execute (GitFlowHotfixFinishMojo.java:356)
    at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo (DefaultBuildPluginManager.java:137)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:210)
    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)
    at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:192)
    at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:105)
    at org.apache.maven.cli.MavenCli.execute (MavenCli.java:957)
    at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:289)
    at org.apache.maven.cli.MavenCli.main (MavenCli.java:193)
    at sun.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke (Method.java:498)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced (Launcher.java:282)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launch (Launcher.java:225)
    at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode (Launcher.java:406)
    at org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java:347)
Caused by: org.apache.maven.plugin.MojoFailureException: Hotfix branch with name 'hotfix/3.4.0' doesn't exist. Cannot finish hotfix.
    at com.amashchenko.maven.plugin.gitflow.GitFlowHotfixFinishMojo.execute (GitFlowHotfixFinishMojo.java:137)
    at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo (DefaultBuildPluginManager.java:137)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:210)
    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)
    at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:192)
    at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:105)
    at org.apache.maven.cli.MavenCli.execute (MavenCli.java:957)
    at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:289)
    at org.apache.maven.cli.MavenCli.main (MavenCli.java:193)
    at sun.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke (Method.java:498)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced (Launcher.java:282)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launch (Launcher.java:225)
    at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode (Launcher.java:406)
    at org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java:347)

So in particular: Hotfix branch with name 'hotfix/3.4.0' doesn't exist. Cannot finish hotfix.

I was under the impression whis used to work, but currently it fails for version 1.14.0 as well as for 1.15.0

It looks like a bug to me, but maybe I have to configure something differently?

puce77 commented 3 years ago

I also asked a related question on StackOverflow: https://stackoverflow.com/questions/65550854/git-flow-maven-plugin-hotfix-branch

puce77 commented 3 years ago

Might be a duplicate of #257 and/or #219, but if yes, I still don't know what to change

puce77 commented 3 years ago

What is the format of hotfixVersion?

I used for both hotfix-start and hotfix-finish: -DhotfixVersion=3.4.0

But I've seen some samples where users don't use the parameter for hotfix-start, and in hotfix-finish they use something like: -DhotfixVersion=support/1.11.0/1.11.1

aleksandr-m commented 3 years ago

@puce77 Use -DhotfixVersion=support/release-3.x/3.4.0.

puce77 commented 3 years ago

@aleksandr-m thanks, this worked. I couldn't find any documentation about this though. Please consider to update the documentation.

aleksandr-m commented 3 years ago

@puce77 PR-s to improve documentation are welcome!