@@ -50,6 +50,7 @@ public void afterProjectsRead(MavenSession session) throws MavenExecutionExcepti
5050
5151 // Look for a gitflow-helper-maven-plugin, so we can determine what the gitBranchExpression and masterBranchPattern are...
5252 String masterBranchPattern = null ;
53+ String supportBranchPattern = null ;
5354
5455 String gitBranchExpression = null ;
5556 boolean pluginFound = false ;
@@ -88,6 +89,10 @@ public void afterProjectsRead(MavenSession session) throws MavenExecutionExcepti
8889 masterBranchPattern = extractPluginConfigValue ("masterBranchPattern" , plugin );
8990 }
9091
92+ if (supportBranchPattern == null ) {
93+ supportBranchPattern = extractPluginConfigValue ("supportBranchPattern" , plugin );
94+ }
95+
9196 if (gitBranchExpression == null ) {
9297 gitBranchExpression = extractPluginConfigValue ("gitBranchExpression" , plugin );
9398 }
@@ -109,10 +114,16 @@ public void afterProjectsRead(MavenSession session) throws MavenExecutionExcepti
109114 if (pluginFound ) {
110115 if (masterBranchPattern == null ) {
111116 logger .debug ("Using default master branch Pattern." );
112- masterBranchPattern = "origin/master" ;
117+ masterBranchPattern = "( origin/)? master" ;
113118 }
114119 logger .debug ("Master Branch Pattern: " + masterBranchPattern );
115120
121+ if (supportBranchPattern == null ) {
122+ logger .debug ("Using default support branch Pattern." );
123+ supportBranchPattern = "(origin/)?support/(.*)" ;
124+ }
125+ logger .debug ("Support Branch Pattern: " + supportBranchPattern );
126+
116127 if (gitBranchExpression == null ) {
117128 logger .debug ("Using default branch expression resolver." );
118129 gitBranchExpression = ScmUtils .resolveBranchOrExpression (scmManager , session .getTopLevelProject (), new DefaultLog (logger ));
@@ -124,10 +135,17 @@ public void afterProjectsRead(MavenSession session) throws MavenExecutionExcepti
124135 String gitBranch = pr .resolveValue (gitBranchExpression , session .getCurrentProject ().getProperties (), systemEnvVars );
125136 logger .info ("gitflow-helper-maven-plugin: Build Extension resolved gitBranchExpression: " + gitBranchExpression + " to: " + gitBranch );
126137
127- // Test to see if the current GIT_BRANCH matches the masterBranchPattern...
138+ // If the current git branch matches the master or support branch, prune the build plugin list.
139+ boolean pruneBuild = false ;
128140 if (gitBranch != null && gitBranch .matches (masterBranchPattern )) {
129141 logger .info ("gitflow-helper-maven-plugin: Enabling MasterPromoteExtension. GIT_BRANCH: [" + gitBranch + "] matches masterBranchPattern: [" + masterBranchPattern + "]" );
142+ pruneBuild = true ;
143+ } else if (gitBranch != null && gitBranch .matches (supportBranchPattern )) {
144+ logger .info ("gitflow-helper-maven-plugin: Enabling MasterPromoteExtension. GIT_BRANCH: [" + gitBranch + "] matches supportBranchPattern: [" + supportBranchPattern + "]" );
145+ pruneBuild = true ;
146+ }
130147
148+ if (pruneBuild ) {
131149 for (MavenProject project : session .getProjects ()) {
132150 // Drop all the plugins from the build except for the gitflow-helper-maven-plugin, or plugins we
133151 // invoked goals for which could be mapped back to plugins in our project build.
0 commit comments