@@ -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.
@@ -1122,7 +1158,26 @@ private void executeGitCommand(final String... args)
1122
1158
*/
1123
1159
private void executeMvnCommand (final String ... args )
1124
1160
throws CommandLineException , MojoFailureException {
1125
- executeCommand (cmdMvn , true , argLine , args );
1161
+
1162
+ initMavenDefaults ();
1163
+
1164
+ final List <String > argLines = new ArrayList <String >();
1165
+
1166
+ if (StringUtils .isBlank (this .argLine )
1167
+ || !this .argLine .contains ("-gs" )) {
1168
+ argLines .add ("-gs" );
1169
+ argLines .add (this .globalSettings );
1170
+ }
1171
+ if (StringUtils .isBlank (this .argLine )
1172
+ || !this .argLine .contains ("-s" )) {
1173
+ argLines .add ("-s" );
1174
+ argLines .add (this .userSettings );
1175
+ }
1176
+ if (StringUtils .isNotBlank (this .argLine )) {
1177
+ argLines .add (this .argLine );
1178
+ }
1179
+
1180
+ executeCommand (cmdMvn , true , StringUtils .join (argLines .toArray (), " " ), args );
1126
1181
}
1127
1182
1128
1183
/**
0 commit comments