@@ -50,6 +50,7 @@ public void afterProjectsRead(MavenSession session) throws MavenExecutionExcepti
50
50
51
51
// Look for a gitflow-helper-maven-plugin, so we can determine what the gitBranchExpression and masterBranchPattern are...
52
52
String masterBranchPattern = null ;
53
+ String supportBranchPattern = null ;
53
54
54
55
String gitBranchExpression = null ;
55
56
boolean pluginFound = false ;
@@ -88,6 +89,10 @@ public void afterProjectsRead(MavenSession session) throws MavenExecutionExcepti
88
89
masterBranchPattern = extractPluginConfigValue ("masterBranchPattern" , plugin );
89
90
}
90
91
92
+ if (supportBranchPattern == null ) {
93
+ supportBranchPattern = extractPluginConfigValue ("supportBranchPattern" , plugin );
94
+ }
95
+
91
96
if (gitBranchExpression == null ) {
92
97
gitBranchExpression = extractPluginConfigValue ("gitBranchExpression" , plugin );
93
98
}
@@ -109,10 +114,16 @@ public void afterProjectsRead(MavenSession session) throws MavenExecutionExcepti
109
114
if (pluginFound ) {
110
115
if (masterBranchPattern == null ) {
111
116
logger .debug ("Using default master branch Pattern." );
112
- masterBranchPattern = "origin/master" ;
117
+ masterBranchPattern = "( origin/)? master" ;
113
118
}
114
119
logger .debug ("Master Branch Pattern: " + masterBranchPattern );
115
120
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
+
116
127
if (gitBranchExpression == null ) {
117
128
logger .debug ("Using default branch expression resolver." );
118
129
gitBranchExpression = ScmUtils .resolveBranchOrExpression (scmManager , session .getTopLevelProject (), new DefaultLog (logger ));
@@ -124,10 +135,17 @@ public void afterProjectsRead(MavenSession session) throws MavenExecutionExcepti
124
135
String gitBranch = pr .resolveValue (gitBranchExpression , session .getCurrentProject ().getProperties (), systemEnvVars );
125
136
logger .info ("gitflow-helper-maven-plugin: Build Extension resolved gitBranchExpression: " + gitBranchExpression + " to: " + gitBranch );
126
137
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 ;
128
140
if (gitBranch != null && gitBranch .matches (masterBranchPattern )) {
129
141
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
+ }
130
147
148
+ if (pruneBuild ) {
131
149
for (MavenProject project : session .getProjects ()) {
132
150
// Drop all the plugins from the build except for the gitflow-helper-maven-plugin, or plugins we
133
151
// invoked goals for which could be mapped back to plugins in our project build.
0 commit comments