Exception when attempting to merge pom versions where no base pom.xml is available
Closed this issue · 4 comments
Sometimes I get exceptions when merging poms and I can't quite figure out why.
My git config for the merge driver is set to
merge.pom.driver=java -jar pomutils-1.4.jar --debug merge --base=%O --our=%A --their=%B --select=their
The error message:
[main] WARN de.oppermann.pomutils.PomMergeDriver - Exception when attempting to merge pom versions. Falling back to default merge.
java.io.EOFException: input contained no data
at org.codehaus.plexus.util.xml.pull.MXParser.fillBuf(MXParser.java:3005)
at org.codehaus.plexus.util.xml.pull.MXParser.more(MXParser.java:3048)
at org.codehaus.plexus.util.xml.pull.MXParser.parseProlog(MXParser.java:1422)
at org.codehaus.plexus.util.xml.pull.MXParser.nextImpl(MXParser.java:1407)
at org.codehaus.plexus.util.xml.pull.MXParser.next(MXParser.java:1105)
at org.apache.maven.model.io.xpp3.MavenXpp3Reader.read(MavenXpp3Reader.java:3911)
at org.apache.maven.model.io.xpp3.MavenXpp3Reader.read(MavenXpp3Reader.java:3926)
at org.codehaus.mojo.versions.api.PomHelper.getRawModel(PomHelper.java:148)
at de.oppermann.pomutils.util.POM.initialize(POM.java:89)
at de.oppermann.pomutils.util.POM.<init>(POM.java:76)
at de.oppermann.pomutils.PomMergeDriver.merge(PomMergeDriver.java:61)
at de.oppermann.pomutils.Main.executePomMergeDriver(Main.java:98)
at de.oppermann.pomutils.Main.mainInternal(Main.java:85)
at de.oppermann.pomutils.Main.main(Main.java:49)
When I check the unmerged pom.xml afterwards it has the following content:
<<<<<<< ours
<version>2017.3.0-SNAPSHOT</version>
=======
<version>2017.3.0</version>
>>>>>>> theirs
Not sure if it's an issue with pomutils or an issue with my poms.
Do you have any idea?
It looks like there is a problem with your "base" pom. If you execute the following:
git merge-base <branch1> <branch2>
git show <sha1>:<pathToPom>/pom.xml
In the first command fill branch1 and branch2 with the branches you were merging.
Then you get a SHA1. Use this in the second command and also add the path to your pom. Than you see the pom which is used as base pom. Post the content of the version tag.
Thanks for the fast response!
It's actually a git merge of unrelated histories (no way around it in this case), so there is no base pom I guess.
Is it possible to add support for merges of unrelated histories?
I understand. Give me a day or two and i will have a look.
I had some time and fixed it myself. It's pretty minimal but should not be breaking anything.