@@ -117,6 +117,26 @@ public abstract class AbstractGitFlowMojo extends AbstractMojo {
117117 @ Parameter (property = "argLine" )
118118 private String argLine ;
119119
120+ /**
121+ * Global setting file to pass to the underlying Maven commands.
122+ * <br/>
123+ * If not defined will default to global settings file of executing Maven command.
124+ *
125+ * @since 1.14.1
126+ */
127+ @ Parameter (property = "gitflow.maven.settings.global" )
128+ private String globalSettings ;
129+
130+ /**
131+ * User setting file to pass to the underlying Maven commands.
132+ * <br/>
133+ * If not defined will default to user settings file of executing Maven command.
134+ *
135+ * @since 1.14.1
136+ */
137+ @ Parameter (property = "gitflow.maven.settings.user" )
138+ private String userSettings ;
139+
120140 /**
121141 * Whether to make a GPG-signed commit.
122142 *
@@ -203,6 +223,22 @@ private void initExecutables() {
203223 }
204224 }
205225
226+ /**
227+ * Initializes maven defaults.
228+ */
229+ private void initMavenDefaults () {
230+ if (StringUtils .isBlank (this .globalSettings )) {
231+ this .globalSettings = this .mavenSession .getRequest ()
232+ .getGlobalSettingsFile ()
233+ .getAbsolutePath ();
234+ }
235+ if (StringUtils .isBlank (this .userSettings )) {
236+ this .userSettings = this .mavenSession .getRequest ()
237+ .getUserSettingsFile ()
238+ .getAbsolutePath ();
239+ }
240+ }
241+
206242 /**
207243 * Validates plugin configuration. Throws exception if configuration is not
208244 * valid.
@@ -1123,7 +1159,26 @@ private void executeGitCommand(final String... args)
11231159 */
11241160 private void executeMvnCommand (final String ... args )
11251161 throws CommandLineException , MojoFailureException {
1126- executeCommand (cmdMvn , true , argLine , args );
1162+
1163+ initMavenDefaults ();
1164+
1165+ final List <String > argLines = new ArrayList <String >();
1166+
1167+ if (StringUtils .isBlank (this .argLine )
1168+ || !this .argLine .contains ("-gs" )) {
1169+ argLines .add ("-gs" );
1170+ argLines .add (this .globalSettings );
1171+ }
1172+ if (StringUtils .isBlank (this .argLine )
1173+ || !this .argLine .contains ("-s" )) {
1174+ argLines .add ("-s" );
1175+ argLines .add (this .userSettings );
1176+ }
1177+ if (StringUtils .isNotBlank (this .argLine )) {
1178+ argLines .add (this .argLine );
1179+ }
1180+
1181+ executeCommand (cmdMvn , true , StringUtils .join (argLines .toArray (), " " ), args );
11271182 }
11281183
11291184 /**
0 commit comments