@@ -124,6 +124,26 @@ public abstract class AbstractGitFlowMojo extends AbstractMojo {
124124 @ Parameter (property = "argLine" )
125125 private String argLine ;
126126
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+
127147 /**
128148 * Whether to make a GPG-signed commit.
129149 *
@@ -225,6 +245,22 @@ private void initExecutables() {
225245 }
226246 }
227247
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+
228264 /**
229265 * Validates plugin configuration. Throws exception if configuration is not
230266 * valid.
@@ -1188,7 +1224,26 @@ private void executeGitCommand(final String... args)
11881224 */
11891225 private void executeMvnCommand (final String ... args )
11901226 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 );
11921247 }
11931248
11941249 /**
0 commit comments