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 32803926..f5baf75b 100644
--- a/src/main/java/com/amashchenko/maven/plugin/gitflow/AbstractGitFlowMojo.java
+++ b/src/main/java/com/amashchenko/maven/plugin/gitflow/AbstractGitFlowMojo.java
@@ -117,6 +117,26 @@ public abstract class AbstractGitFlowMojo extends AbstractMojo {
@Parameter(property = "argLine")
private String argLine;
+ /**
+ * Global setting file to pass to the underlying Maven commands.
+ *
+ * If not defined will default to global settings file of executing Maven command.
+ *
+ * @since 1.14.1
+ */
+ @Parameter(property = "gitflow.maven.settings.global")
+ private String globalSettings;
+
+ /**
+ * User setting file to pass to the underlying Maven commands.
+ *
+ * If not defined will default to user settings file of executing Maven command.
+ *
+ * @since 1.14.1
+ */
+ @Parameter(property = "gitflow.maven.settings.user")
+ private String userSettings;
+
/**
* Whether to make a GPG-signed commit.
*
@@ -203,6 +223,22 @@ private void initExecutables() {
}
}
+ /**
+ * Initializes maven defaults.
+ */
+ private void initMavenDefaults() {
+ if (StringUtils.isBlank(this.globalSettings)) {
+ this.globalSettings = this.mavenSession.getRequest()
+ .getGlobalSettingsFile()
+ .getAbsolutePath();
+ }
+ if (StringUtils.isBlank(this.userSettings)) {
+ this.userSettings = this.mavenSession.getRequest()
+ .getUserSettingsFile()
+ .getAbsolutePath();
+ }
+ }
+
/**
* Validates plugin configuration. Throws exception if configuration is not
* valid.
@@ -1123,7 +1159,26 @@ private void executeGitCommand(final String... args)
*/
private void executeMvnCommand(final String... args)
throws CommandLineException, MojoFailureException {
- executeCommand(cmdMvn, true, argLine, args);
+
+ initMavenDefaults();
+
+ final List argLines = new ArrayList();
+
+ if (StringUtils.isBlank(this.argLine)
+ || !this.argLine.contains("-gs")) {
+ argLines.add("-gs");
+ argLines.add(this.globalSettings);
+ }
+ if (StringUtils.isBlank(this.argLine)
+ || !this.argLine.contains("-s")) {
+ argLines.add("-s");
+ argLines.add(this.userSettings);
+ }
+ if (StringUtils.isNotBlank(this.argLine)) {
+ argLines.add(this.argLine);
+ }
+
+ executeCommand(cmdMvn, true, StringUtils.join(argLines.toArray(), " "), args);
}
/**