From 4189dfd368d4706240e0f7fa67c619131c79fc72 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 | 24 ++++++++++++++++++- 1 file changed, 23 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 ee1756fc..66f3486c 100644 --- a/src/main/java/com/amashchenko/maven/plugin/gitflow/AbstractGitFlowMojo.java +++ b/src/main/java/com/amashchenko/maven/plugin/gitflow/AbstractGitFlowMojo.java @@ -1159,10 +1159,32 @@ private CommandResult executeCommand(final Commandline cmd, cmd.clearArgs(); cmd.addArguments(args); + final String globalSettingsFileArgLine = String.format("-gs %s", this.mavenSession.getRequest() + .getGlobalSettingsFile() + .getAbsolutePath()); + + final String userSettingsFileArgLine = String.format("-s %s", this.mavenSession.getRequest() + .getUserSettingsFile() + .getAbsolutePath()); + + final StringBuilder argLineStr = new StringBuilder(); + if (StringUtils.isNotBlank(argStr)) { - cmd.createArg().setLine(argStr); + argLineStr.append(globalSettingsFileArgLine); + argLineStr.append(userSettingsFileArgLine); + + } else { + if (!argStr.contains("-gs")) { + argLineStr.append(globalSettingsFileArgLine); + } + if (!argStr.contains("-s")) { + argLineStr.append(userSettingsFileArgLine); + } + argLineStr.append(argStr); } + cmd.createArg().setLine(argLineStr.toString()); + final StringBufferStreamConsumer out = new StringBufferStreamConsumer( verbose);