@@ -123,6 +123,26 @@ public abstract class AbstractGitFlowMojo extends AbstractMojo {
123
123
@ Parameter (property = "argLine" )
124
124
private String argLine ;
125
125
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
+
126
146
/**
127
147
* Whether to make a GPG-signed commit.
128
148
*
@@ -217,6 +237,22 @@ private void initExecutables() {
217
237
}
218
238
}
219
239
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
+
220
256
/**
221
257
* Validates plugin configuration. Throws exception if configuration is not
222
258
* valid.
@@ -1180,7 +1216,26 @@ private void executeGitCommand(final String... args)
1180
1216
*/
1181
1217
private void executeMvnCommand (final String ... args )
1182
1218
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 );
1184
1239
}
1185
1240
1186
1241
/**
0 commit comments