@@ -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.
@@ -1122,7 +1158,26 @@ private void executeGitCommand(final String... args)
11221158 */
11231159 private void executeMvnCommand (final String ... args )
11241160 throws CommandLineException , MojoFailureException {
1125- executeCommand (cmdMvn , true , argLine , args );
1161+
1162+ initMavenDefaults ();
1163+
1164+ final List <String > argLines = new ArrayList <String >();
1165+
1166+ if (StringUtils .isBlank (this .argLine )
1167+ || !this .argLine .contains ("-gs" )) {
1168+ argLines .add ("-gs" );
1169+ argLines .add (this .globalSettings );
1170+ }
1171+ if (StringUtils .isBlank (this .argLine )
1172+ || !this .argLine .contains ("-s" )) {
1173+ argLines .add ("-s" );
1174+ argLines .add (this .userSettings );
1175+ }
1176+ if (StringUtils .isNotBlank (this .argLine )) {
1177+ argLines .add (this .argLine );
1178+ }
1179+
1180+ executeCommand (cmdMvn , true , StringUtils .join (argLines .toArray (), " " ), args );
11261181 }
11271182
11281183 /**
0 commit comments