@@ -117,6 +117,26 @@ public abstract class AbstractGitFlowMojo extends AbstractMojo {
117
117
@ Parameter (property = "argLine" )
118
118
private String argLine ;
119
119
120
+ /**
121
+ * Global setting file to pass to the underlying Maven commands.
122
+ * <br/>
123
+ * If not defined will default to global settings file of executing Maven command.
124
+ *
125
+ * @since 1.14.1
126
+ */
127
+ @ Parameter (property = "gitflow.maven.settings.global" )
128
+ private String globalSettings ;
129
+
130
+ /**
131
+ * User setting file to pass to the underlying Maven commands.
132
+ * <br/>
133
+ * If not defined will default to user settings file of executing Maven command.
134
+ *
135
+ * @since 1.14.1
136
+ */
137
+ @ Parameter (property = "gitflow.maven.settings.user" )
138
+ private String userSettings ;
139
+
120
140
/**
121
141
* Whether to make a GPG-signed commit.
122
142
*
@@ -203,6 +223,22 @@ private void initExecutables() {
203
223
}
204
224
}
205
225
226
+ /**
227
+ * Initializes maven defaults.
228
+ */
229
+ private void initMavenDefaults () {
230
+ if (StringUtils .isBlank (this .globalSettings )) {
231
+ this .globalSettings = this .mavenSession .getRequest ()
232
+ .getGlobalSettingsFile ()
233
+ .getAbsolutePath ();
234
+ }
235
+ if (StringUtils .isBlank (this .userSettings )) {
236
+ this .userSettings = this .mavenSession .getRequest ()
237
+ .getUserSettingsFile ()
238
+ .getAbsolutePath ();
239
+ }
240
+ }
241
+
206
242
/**
207
243
* Validates plugin configuration. Throws exception if configuration is not
208
244
* valid.
@@ -1134,7 +1170,26 @@ private void executeGitCommand(final String... args)
1134
1170
*/
1135
1171
private void executeMvnCommand (final String ... args )
1136
1172
throws CommandLineException , MojoFailureException {
1137
- executeCommand (cmdMvn , true , argLine , args );
1173
+
1174
+ initMavenDefaults ();
1175
+
1176
+ final List <String > argLines = new ArrayList <String >();
1177
+
1178
+ if (StringUtils .isBlank (this .argLine )
1179
+ || !this .argLine .contains ("-gs" )) {
1180
+ argLines .add ("-gs" );
1181
+ argLines .add (this .globalSettings );
1182
+ }
1183
+ if (StringUtils .isBlank (this .argLine )
1184
+ || !this .argLine .contains ("-s" )) {
1185
+ argLines .add ("-s" );
1186
+ argLines .add (this .userSettings );
1187
+ }
1188
+ if (StringUtils .isNotBlank (this .argLine )) {
1189
+ argLines .add (this .argLine );
1190
+ }
1191
+
1192
+ executeCommand (cmdMvn , true , StringUtils .join (argLines .toArray (), " " ), args );
1138
1193
}
1139
1194
1140
1195
/**
0 commit comments