From 10185fb33dc931cf0598376ac6504e3b4c4c1148 Mon Sep 17 00:00:00 2001 From: John Patrick <142304+nhojpatrick@users.noreply.github.com> Date: Mon, 27 Jul 2020 16:42:52 +0100 Subject: [PATCH] Inherit Global Settings and User Settings --- .../plugin/gitflow/AbstractGitFlowMojo.java | 23 ++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/src/main/java/com/amashchenko/maven/plugin/gitflow/AbstractGitFlowMojo.java b/src/main/java/com/amashchenko/maven/plugin/gitflow/AbstractGitFlowMojo.java index c668086a..2d9a491f 100644 --- a/src/main/java/com/amashchenko/maven/plugin/gitflow/AbstractGitFlowMojo.java +++ b/src/main/java/com/amashchenko/maven/plugin/gitflow/AbstractGitFlowMojo.java @@ -1180,7 +1180,28 @@ private void executeGitCommand(final String... args) */ private void executeMvnCommand(final String... args) throws CommandLineException, MojoFailureException { - executeCommand(cmdMvn, true, argLine, args); + + final List argLines = new ArrayList(); + + if (StringUtils.isBlank(this.argLine) + || !this.argLine.contains("-gs")) { + argLines.add("-gs"); + argLines.add(this.mavenSession.getRequest() + .getGlobalSettingsFile() + .getAbsolutePath()); + } + if (StringUtils.isBlank(this.argLine) + || !this.argLine.contains("-s")) { + argLines.add("-s"); + argLines.add(this.mavenSession.getRequest() + .getUserSettingsFile() + .getAbsolutePath()); + } + if (StringUtils.isNotBlank(this.argLine)) { + argLines.add(this.argLine); + } + + executeCommand(cmdMvn, true, StringUtils.join(argLines.toArray(), " "), args); } /**