@@ -123,6 +123,26 @@ public abstract class AbstractGitFlowMojo extends AbstractMojo {
123123 @ Parameter (property = "argLine" )
124124 private String argLine ;
125125
126+ /**
127+ * Global setting file to pass to the underlying Maven commands.
128+ * <br/>
129+ * If not defined will default to global settings file of executing Maven command.
130+ *
131+ * @since 1.14.1
132+ */
133+ @ Parameter (property = "gitflow.maven.settings.global" )
134+ private String globalSettings ;
135+
136+ /**
137+ * User setting file to pass to the underlying Maven commands.
138+ * <br/>
139+ * If not defined will default to user settings file of executing Maven command.
140+ *
141+ * @since 1.14.1
142+ */
143+ @ Parameter (property = "gitflow.maven.settings.user" )
144+ private String userSettings ;
145+
126146 /**
127147 * Whether to make a GPG-signed commit.
128148 *
@@ -217,6 +237,22 @@ private void initExecutables() {
217237 }
218238 }
219239
240+ /**
241+ * Initializes maven defaults.
242+ */
243+ private void initMavenDefaults () {
244+ if (StringUtils .isBlank (this .globalSettings )) {
245+ this .globalSettings = this .mavenSession .getRequest ()
246+ .getGlobalSettingsFile ()
247+ .getAbsolutePath ();
248+ }
249+ if (StringUtils .isBlank (this .userSettings )) {
250+ this .userSettings = this .mavenSession .getRequest ()
251+ .getUserSettingsFile ()
252+ .getAbsolutePath ();
253+ }
254+ }
255+
220256 /**
221257 * Validates plugin configuration. Throws exception if configuration is not
222258 * valid.
@@ -1180,7 +1216,26 @@ private void executeGitCommand(final String... args)
11801216 */
11811217 private void executeMvnCommand (final String ... args )
11821218 throws CommandLineException , MojoFailureException {
1183- executeCommand (cmdMvn , true , argLine , args );
1219+
1220+ initMavenDefaults ();
1221+
1222+ final List <String > argLines = new ArrayList <String >();
1223+
1224+ if (StringUtils .isBlank (this .argLine )
1225+ || !this .argLine .contains ("-gs" )) {
1226+ argLines .add ("-gs" );
1227+ argLines .add (this .globalSettings );
1228+ }
1229+ if (StringUtils .isBlank (this .argLine )
1230+ || !this .argLine .contains ("-s" )) {
1231+ argLines .add ("-s" );
1232+ argLines .add (this .userSettings );
1233+ }
1234+ if (StringUtils .isNotBlank (this .argLine )) {
1235+ argLines .add (this .argLine );
1236+ }
1237+
1238+ executeCommand (cmdMvn , true , StringUtils .join (argLines .toArray (), " " ), args );
11841239 }
11851240
11861241 /**
0 commit comments