views:

38

answers:

2

Hi, following standard practice, I have an svn trunk for feature development, and a forked-off branch for building releases. The branch has been created using the maven release plugin, which is also used for creating releases. As it happens, the occasional bug will be fixed on the branch, and those changes need to be merged back into the trunk. To not miss any changes, I'd like to be able to simply merge the complete branch back into the trunk.

Now my problem is that I get numerous conflicts in all my poms because project/dependency versions diverged in the branch and in the trunk, due to the release plugin incrementing version numbers. Does anybody have an idea how to restructure branch creation, my poms or releasing to avoid those merge conflicts?

Thanks.

+1  A: 

This is inherent in using Maven POMs and Subversion branches together in this way. You have a few options.

  1. do your merges starting with a revision in SVN to avoid the commit that bumped the snapshot. Sometimes simpler, but not the ideal way to merge and can still end up with conflicts
  2. check the conflicts and use mine-conflict (mc) as the option if POM changes are the only ones. If you're confident of this, you can use SVN's --accept mine-conflict
  3. allow them to be incorrectly merged and use the Version's plugin to reset the version afterwards with versions:set
Brett Porter
Thank you for your well-written response. Especially 3. helped me a lot.
Nico
A: 

Based on Brett Porter's answer, I think I'll do the following:

Reorganise branching: The cause of the conflicts seems that the release plugin changes the trunk and branch versions after creating the Subversion branch. To work around this, I'll

  1. bump the trunk version with versions:set.
  2. use release:branch to create the branch, but set -DupdateWorkingCopyVersions=false because I've already set the version.

This will avoid the merge conflicts. What remains is that whenever I merge the branch back to the trunk, I'll now merge in the branch version too. Again, versions:set to the rescue.

Nico