@@ -124,6 +124,26 @@ public abstract class AbstractGitFlowMojo extends AbstractMojo {
124
124
@ Parameter (property = "argLine" )
125
125
private String argLine ;
126
126
127
+ /**
128
+ * Global setting file to pass to the underlying Maven commands.
129
+ * <br/>
130
+ * If not defined will default to global settings file of executing Maven command.
131
+ *
132
+ * @since 1.14.1
133
+ */
134
+ @ Parameter (property = "gitflow.maven.settings.global" )
135
+ private String globalSettings ;
136
+
137
+ /**
138
+ * User setting file to pass to the underlying Maven commands.
139
+ * <br/>
140
+ * If not defined will default to user settings file of executing Maven command.
141
+ *
142
+ * @since 1.14.1
143
+ */
144
+ @ Parameter (property = "gitflow.maven.settings.user" )
145
+ private String userSettings ;
146
+
127
147
/**
128
148
* Whether to make a GPG-signed commit.
129
149
*
@@ -225,6 +245,22 @@ private void initExecutables() {
225
245
}
226
246
}
227
247
248
+ /**
249
+ * Initializes maven defaults.
250
+ */
251
+ private void initMavenDefaults () {
252
+ if (StringUtils .isBlank (this .globalSettings )) {
253
+ this .globalSettings = this .mavenSession .getRequest ()
254
+ .getGlobalSettingsFile ()
255
+ .getAbsolutePath ();
256
+ }
257
+ if (StringUtils .isBlank (this .userSettings )) {
258
+ this .userSettings = this .mavenSession .getRequest ()
259
+ .getUserSettingsFile ()
260
+ .getAbsolutePath ();
261
+ }
262
+ }
263
+
228
264
/**
229
265
* Validates plugin configuration. Throws exception if configuration is not
230
266
* valid.
@@ -1188,7 +1224,26 @@ private void executeGitCommand(final String... args)
1188
1224
*/
1189
1225
private void executeMvnCommand (final String ... args )
1190
1226
throws CommandLineException , MojoFailureException {
1191
- executeCommand (cmdMvn , true , argLine , args );
1227
+
1228
+ initMavenDefaults ();
1229
+
1230
+ final List <String > argLines = new ArrayList <String >();
1231
+
1232
+ if (StringUtils .isBlank (this .argLine )
1233
+ || !this .argLine .contains ("-gs" )) {
1234
+ argLines .add ("-gs" );
1235
+ argLines .add (this .globalSettings );
1236
+ }
1237
+ if (StringUtils .isBlank (this .argLine )
1238
+ || !this .argLine .contains ("-s" )) {
1239
+ argLines .add ("-s" );
1240
+ argLines .add (this .userSettings );
1241
+ }
1242
+ if (StringUtils .isNotBlank (this .argLine )) {
1243
+ argLines .add (this .argLine );
1244
+ }
1245
+
1246
+ executeCommand (cmdMvn , true , StringUtils .join (argLines .toArray (), " " ), args );
1192
1247
}
1193
1248
1194
1249
/**
0 commit comments