@@ -139,6 +139,26 @@ public abstract class AbstractGitFlowMojo extends AbstractMojo {
139
139
@ Parameter (property = "argLine" )
140
140
private String argLine ;
141
141
142
+ /**
143
+ * Global setting file to pass to the underlying Maven commands.
144
+ * <br/>
145
+ * If not defined will default to global settings file of executing Maven command.
146
+ *
147
+ * @since 1.14.1
148
+ */
149
+ @ Parameter (property = "gitflow.maven.settings.global" )
150
+ private String globalSettings ;
151
+
152
+ /**
153
+ * User setting file to pass to the underlying Maven commands.
154
+ * <br/>
155
+ * If not defined will default to user settings file of executing Maven command.
156
+ *
157
+ * @since 1.14.1
158
+ */
159
+ @ Parameter (property = "gitflow.maven.settings.user" )
160
+ private String userSettings ;
161
+
142
162
/**
143
163
* Whether to make a GPG-signed commit.
144
164
*
@@ -297,6 +317,22 @@ private void initExecutables() {
297
317
}
298
318
}
299
319
320
+ /**
321
+ * Initializes maven defaults.
322
+ */
323
+ private void initMavenDefaults () {
324
+ if (StringUtils .isBlank (this .globalSettings )) {
325
+ this .globalSettings = this .mavenSession .getRequest ()
326
+ .getGlobalSettingsFile ()
327
+ .getAbsolutePath ();
328
+ }
329
+ if (StringUtils .isBlank (this .userSettings )) {
330
+ this .userSettings = this .mavenSession .getRequest ()
331
+ .getUserSettingsFile ()
332
+ .getAbsolutePath ();
333
+ }
334
+ }
335
+
300
336
/**
301
337
* Validates plugin configuration. Throws exception if configuration is not
302
338
* 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