Hotfix-finish Always Fails When Parent POM Version Changes

1,248 views
Skip to first unread message

Jonathan Cone

unread,
Mar 18, 2016, 2:58:07 PM3/18/16
to Maven JGit Flow Plugin
I'm having trouble with the jgitflow:hotfix-finish goal.  It seems to always fail on a merge conflict if you update the parent POM version in a project inside of a hotfix branch. Some details:

  1. One parent project for 35 discrete child modules
  2. All in different repos, these are not Maven multi-module projects in relation to the parent 
  3. I want to share a common release version across projects

To accomplish this, I iterate through the modules in order of their dependency graph with the parent being first and start the hotfixes:
  1. Start a hotfix (hotfix-start) on the project
  2. Bump its parent version up to the hotfix SNAPSHOT version
  3. Commit, push, clean and deploy
<...Make any changes for the hotfix itself...>

To finish the hotfixes:
  1. Update the parent to the release version
  2. Commit and push
  3. Finish the hotfix (hotfix-finish)

Pseudocommands:

(develop)         mvn -DreleaseVersion=${NEXT_VERSION} -DallowSnapshots=true jgitflow:hotfix-start
(hotfix-4.11.13) mvn -DparentVersion=[${NEXT_VERSION}-SNAPSHOT] -DgenerateBackupPoms=false -DallowSnapshots=true versions:update-parent
(hotfix-4.11.13) git add pom.xml
(hotfix-4.11.13) git commit --allow-empty -m "Updating pom.xml to latest parent SNAPSHOT versions."
(hotfix-4.11.13) git push
(hotfix-4.11.13) mvn clean deploy

<...Make any changes for the hotfix itself...>

(hotfix-4.11.13) mvn -DgenerateBackupPoms=false -DparentVersion=[${NEXT_VERSION}] versions:update-parent
(hotfix-4.11.13) git add pom.xml
(hotfix-4.11.13) git commit --allow-empty -m "Updating pom.xml to latest parent RELEASE versions."
(hotfix-4.11.13) git push
(develop) mvn jgitflow:hotfix-finish

Error:

[INFO] (develop) copying pom versions...
[INFO] (develop) updating poms for all projects...
[INFO] turn on debug logging with -X to see exact changes
[INFO] (develop) updating pom for my-project...
[WARNING] Error running JGitFlow Extension
com.atlassian.jgitflow.core.exception.JGitFlowExtensionException: Error updating develop poms to previously cached versions
        at com.atlassian.maven.plugins.jgitflow.extension.command.UpdateDevelopWithPreviousVersionsCommand.execute(UpdateDevelopWithPreviousVersionsCommand.java:70)
        at com.atlassian.jgitflow.core.command.AbstractGitFlowCommand.runExtensionCommands(AbstractGitFlowCommand.java:255)
        at com.atlassian.jgitflow.core.command.AbstractBranchMergingCommand.doMerge(AbstractBranchMergingCommand.java:94)
        at com.atlassian.jgitflow.core.command.AbstractBranchMergingCommand.doMerge(AbstractBranchMergingCommand.java:44)
        at com.atlassian.jgitflow.core.command.AbstractBranchMergingCommand.doMerge(AbstractBranchMergingCommand.java:39)
        at com.atlassian.jgitflow.core.command.HotfixFinishCommand.call(HotfixFinishCommand.java:128)
        at com.atlassian.maven.plugins.jgitflow.manager.DefaultFlowHotfixManager.finish(DefaultFlowHotfixManager.java:93)
        at com.atlassian.maven.plugins.jgitflow.mojo.HotfixFinishMojo.execute(HotfixFinishMojo.java:167)
<snip snip snip>  
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:497)
        at com.atlassian.maven.plugins.jgitflow.helper.DefaultMavenExecutionHelper.reloadReactor(DefaultMavenExecutionHelper.java:143)
        ... 31 more
Caused by: org.apache.maven.project.ProjectBuildingException: Some problems were encountered while processing the POMs:
[FATAL] Non-parseable POM C:\my-project\pom.xml: unexpected character in markup < (position: END_TAG seen ...<groupId>com.myproject</groupId>\r\n<<... @11:3)  @ line 11, column 3

        at org.apache.maven.project.DefaultProjectBuilder.build(DefaultProjectBuilder.java:364)
        ... 36 more
[ERROR] Error merging into develop:
[ERROR] Merge of revisions e47a0ed2df39058078985b12518c128e8e3d421c, 5fcd5281bbb9ccb3ea4fdd34b7907550d38e2930 with base 41d545847493837cbd2562c362e22dc02e19d710 using strategy recursive resulted in: Conflicting.
[ERROR] see .git/jgitflow.log for more info
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE



The problem occurs when the develop pom is being updated to avoid merge conflicts on the project version.  Is there a way to specify that the parent version also be updated?  Or even a way to always choose the pom from the develop branch (I realize the risk here)?  Perhaps there is a combination of flags I need to pass to the plugin? The documentation is a little light so any help at all would be appreciated.  If a code change is needed I could even put together a PR for this if someone can point me in the right direction.  Thanks!

Olaf Geibig

unread,
Jun 21, 2016, 10:04:45 AM6/21/16
to Maven JGit Flow Plugin, jonatha...@gmail.com
I have a similar project setup and similar problems. Project consists of services in separate git modules. Services share a common parent pom obtained from nexus, but services are not connected with aggregate poms, so there is no overall pom hierarchy. Just some services consist of several components which are a multi-module build inside of a git module. For the time being as code changes for one release usually involve almost all services we do version the releases with the same version across all services. Most probably later when the system is more mature we want to change to individual versioning and release cycles for each service.

I encounter the same problem:
[main] INFO com.atlassian.maven.plugins.jgitflow.helper.DefaultPomUpdater - (develop) updating pom for cdl-rest-war...
[main] WARN com.atlassian.jgitflow.core.command.AbstractGitFlowCommand - Error running JGitFlow Extension
com.atlassian.jgitflow.core.exception.JGitFlowExtensionException: Error updating develop poms to previously cached versions
	at com.atlassian.maven.plugins.jgitflow.extension.command.UpdateDevelopWithPreviousVersionsCommand.execute(UpdateDevelopWithPreviousVersionsCommand.java:70)


And then it leaves the develop branch with the release version in the pom. This also happens on release-finish even if there is no change at all in the module. And on release-finish the parent pom version wasn't bumped as this already happened right after release-start. To me this looks like reverting to develop versions does not work when parent-pom version has changed.

Currently I want to experiment with stitching the projects virtually together with the help of git subtrees into a more traditional multi-module build with aggregate poms. And then doing the release magic on this project. Somehow I assume that the problem is not happening when the parent pom is also the aggregate pom, but I haven't tried it yet. I just used jgitflow before in a more monolithic project structure and there was no problem.
Reply all
Reply to author
Forward
0 new messages