0

I have a maven project which have 2 git branches (master and develop), each branch have different maven artifact Id in the pom.xml.

So when i branch out and merge back between master and develop how do i make sure 2 branches have their own pom.xml unchanged. only the rest of the changes are moved around?

12f0af0
  • 105
  • 2
  • 11

1 Answers1

0

Don't do it, it is bad practice. The file should be same. If you need a difference, you could use a maven plugin which could read current branch name (e.g. buildnumber-maven-plugin gives ${scmBranch}) and change maven properties such as artifact ID accordingly.

Also it is bad idea to change artifact ID depending on branch. Better to change a version prefix.

kan
  • 28,279
  • 7
  • 71
  • 101
  • but i am not very sure about the 'version prefix'. can you give an example? – 12f0af0 Apr 15 '16 at 14:41
  • @hotspring Apparently you could do something like this: http://stackoverflow.com/questions/13583953/deriving-maven-artifact-version-from-git-branch But I prefer to have something like CI server (e.g. Jenkins) which does all the magic. – kan Apr 15 '16 at 14:53