@@ -135,6 +135,26 @@ public abstract class AbstractGitFlowMojo extends AbstractMojo {
135
135
@ Parameter (property = "argLine" )
136
136
private String argLine ;
137
137
138
+ /**
139
+ * Global setting file to pass to the underlying Maven commands.
140
+ * <br/>
141
+ * If not defined will default to global settings file of executing Maven command.
142
+ *
143
+ * @since 1.14.1
144
+ */
145
+ @ Parameter (property = "gitflow.maven.settings.global" )
146
+ private String globalSettings ;
147
+
148
+ /**
149
+ * User setting file to pass to the underlying Maven commands.
150
+ * <br/>
151
+ * If not defined will default to user settings file of executing Maven command.
152
+ *
153
+ * @since 1.14.1
154
+ */
155
+ @ Parameter (property = "gitflow.maven.settings.user" )
156
+ private String userSettings ;
157
+
138
158
/**
139
159
* Whether to make a GPG-signed commit.
140
160
*
@@ -279,6 +299,22 @@ private void initExecutables() {
279
299
}
280
300
}
281
301
302
+ /**
303
+ * Initializes maven defaults.
304
+ */
305
+ private void initMavenDefaults () {
306
+ if (StringUtils .isBlank (this .globalSettings )) {
307
+ this .globalSettings = this .mavenSession .getRequest ()
308
+ .getGlobalSettingsFile ()
309
+ .getAbsolutePath ();
310
+ }
311
+ if (StringUtils .isBlank (this .userSettings )) {
312
+ this .userSettings = this .mavenSession .getRequest ()
313
+ .getUserSettingsFile ()
314
+ .getAbsolutePath ();
315
+ }
316
+ }
317
+
282
318
/**
283
319
* Validates plugin configuration. Throws exception if configuration is not
284
320
* valid.
@@ -1320,7 +1356,26 @@ private void executeGitCommand(final String... args)
1320
1356
*/
1321
1357
private void executeMvnCommand (final String ... args )
1322
1358
throws CommandLineException , MojoFailureException {
1323
- executeCommand (cmdMvn , true , argLine , args );
1359
+
1360
+ initMavenDefaults ();
1361
+
1362
+ final List <String > argLines = new ArrayList <String >();
1363
+
1364
+ if (StringUtils .isBlank (this .argLine )
1365
+ || !this .argLine .contains ("-gs" )) {
1366
+ argLines .add ("-gs" );
1367
+ argLines .add (this .globalSettings );
1368
+ }
1369
+ if (StringUtils .isBlank (this .argLine )
1370
+ || !this .argLine .contains ("-s" )) {
1371
+ argLines .add ("-s" );
1372
+ argLines .add (this .userSettings );
1373
+ }
1374
+ if (StringUtils .isNotBlank (this .argLine )) {
1375
+ argLines .add (this .argLine );
1376
+ }
1377
+
1378
+ executeCommand (cmdMvn , true , StringUtils .join (argLines .toArray (), " " ), args );
1324
1379
}
1325
1380
1326
1381
/**
0 commit comments