diff --git a/pom.xml b/pom.xml index e0676e0..b5e6a8f 100644 --- a/pom.xml +++ b/pom.xml @@ -2,7 +2,7 @@ 4.0.0 de.oppermann.pomutils pomutils - 1.0 + 1.1 diff --git a/src/main/java/de/oppermann/pomutils/PomMergeDriver.java b/src/main/java/de/oppermann/pomutils/PomMergeDriver.java index 7728f94..118548d 100644 --- a/src/main/java/de/oppermann/pomutils/PomMergeDriver.java +++ b/src/main/java/de/oppermann/pomutils/PomMergeDriver.java @@ -55,7 +55,7 @@ public void adjustTheirPomVersion() { } public int doGitMerge() { - ProcessBuilder processBuilder = new ProcessBuilder("git", "merge-file", "-p", "-L", "our", "-L", "base", "-L", "theirs", ourPom.getPath(), + ProcessBuilder processBuilder = new ProcessBuilder("git", "merge-file", "-L", "our", "-L", "base", "-L", "theirs", ourPom.getPath(), basePom.getPath(), theirPom.getPath()); processBuilder.redirectErrorStream(true); try { diff --git a/src/test/java/de/oppermann/pomutils/PomMergeDriverTest.java b/src/test/java/de/oppermann/pomutils/PomMergeDriverTest.java index e816ce5..4397f69 100644 --- a/src/test/java/de/oppermann/pomutils/PomMergeDriverTest.java +++ b/src/test/java/de/oppermann/pomutils/PomMergeDriverTest.java @@ -24,6 +24,7 @@ import junit.framework.TestCase; import org.apache.commons.io.FileUtils; +import org.codehaus.mojo.versions.api.PomHelper; import de.oppermann.pomutils.util.POM; @@ -55,11 +56,17 @@ public void testAutoMergeSucceded() throws Exception { int mergeReturnValue = pomMergeDriver.doGitMerge(); assertTrue("merge succeeded", mergeReturnValue == 0); - + POM theirPom = new POM(theirPomFile); POM ourPom = new POM(ourPomFile); assertEquals("same version now", ourPom.getProjectVersion(), theirPom.getProjectVersion()); + + + String theirDependecyVersoin = PomHelper.getRawModel(new File(theirPomFile)).getDependencies().get(0).getVersion(); + String ourDependencyVersion = PomHelper.getRawModel(new File(ourPomFile)).getDependencies().get(0).getVersion(); + + assertEquals("dependency version change merged", theirDependecyVersoin, ourDependencyVersion); } public void testAutoMergeFailed() throws Exception { diff --git a/src/test/resources/merge/autoMergeSucceded/our.pom.xml b/src/test/resources/merge/autoMergeSucceded/our.pom.xml index b957f17..64e97be 100644 --- a/src/test/resources/merge/autoMergeSucceded/our.pom.xml +++ b/src/test/resources/merge/autoMergeSucceded/our.pom.xml @@ -7,7 +7,7 @@ org.codehaus.mojo versions-maven-plugin - 2.5 + 2.1 maven-plugin diff --git a/src/test/resources/merge/autoMergeSucceded/their.pom.xml b/src/test/resources/merge/autoMergeSucceded/their.pom.xml index 8340b8f..4a2675c 100644 --- a/src/test/resources/merge/autoMergeSucceded/their.pom.xml +++ b/src/test/resources/merge/autoMergeSucceded/their.pom.xml @@ -7,7 +7,7 @@ org.codehaus.mojo versions-maven-plugin - 2.1 + 2.5 maven-plugin