diff --git a/src/main/java/de/oppermann/pomutils/Main.java b/src/main/java/de/oppermann/pomutils/Main.java index b4b1971..b502079 100644 --- a/src/main/java/de/oppermann/pomutils/Main.java +++ b/src/main/java/de/oppermann/pomutils/Main.java @@ -19,6 +19,7 @@ * under the License. */ +import org.apache.commons.lang.StringUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.slf4j.impl.SimpleLogger; @@ -43,7 +44,14 @@ public class Main { private static Logger logger = null; public static void main(String... args) { - int resultValue = mainInternal(args); + int resultValue = 0; + try { + resultValue = mainInternal(args); + } catch (Exception e) { + System.err.println("We got an exception on merge: " + StringUtils.join(args, " ")); + e.printStackTrace(); + System.exit(1); + } logger.debug("Exiting with exit code {}", resultValue); System.exit(resultValue); } @@ -84,7 +92,8 @@ protected static int mainInternal(String... args) { } private static int executePomMergeDriver(CommandPomMergeDriver mergeCommand) { - PomMergeDriver pomMergeDriver = new PomMergeDriver(mergeCommand.getRuleSet(), mergeCommand.getBasePom(), mergeCommand.getOurPom(), + PomMergeDriver pomMergeDriver = new PomMergeDriver(mergeCommand.getRuleSet(), mergeCommand.getBasePom(), + mergeCommand.getOurPom(), mergeCommand.getTheirPom()); return pomMergeDriver.merge(); } diff --git a/src/main/java/de/oppermann/pomutils/util/POM.java b/src/main/java/de/oppermann/pomutils/util/POM.java index 067944b..62ad29a 100644 --- a/src/main/java/de/oppermann/pomutils/util/POM.java +++ b/src/main/java/de/oppermann/pomutils/util/POM.java @@ -219,7 +219,7 @@ public Properties getProfileProperties(String profileId) { return profile.getProperties(); } } - throw new IllegalArgumentException("profile [" + profileId + "] not found"); + return new Properties(); } public Properties getProperties() {