Skip to content

Commit de14395

Browse files
committed
Merge pull request #22 from egineering-llc/hotfix/1.2.1
Hotfix 1.2.1 - Forgot an important piece of the puzzle...
2 parents 93c8438 + 72ee320 commit de14395

File tree

3 files changed

+16
-19
lines changed

3 files changed

+16
-19
lines changed

pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
<groupId>com.e-gineering</groupId>
1010
<artifactId>gitflow-helper-maven-plugin</artifactId>
1111

12-
<version>1.2.0</version>
12+
<version>1.2.1</version>
1313
<packaging>maven-plugin</packaging>
1414

1515
<name>gitflow-helper-maven-plugin</name>

src/main/java/com/e_gineering/maven/gitflowhelper/MasterPromoteExtension.java

Lines changed: 12 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ public void afterProjectsRead(MavenSession session) throws MavenExecutionExcepti
3737

3838
// Look for a gitflow-helper-maven-plugin, so we can determine what the gitBranchExpression and masterBranchPattern are...
3939
String masterBranchPattern = null;
40+
4041
String gitBranchExpression = null;
4142
boolean pluginFound = false;
4243

@@ -47,27 +48,21 @@ public void afterProjectsRead(MavenSession session) throws MavenExecutionExcepti
4748
List<Plugin> dropPlugins = new ArrayList<Plugin>();
4849

4950
for (Plugin plugin : project.getBuildPlugins()) {
50-
// Don't drop our plugin. Read it's config.
51+
// Don't drop our plugin. Read it's config
5152
if (plugin.getKey().equals("com.e-gineering:gitflow-helper-maven-plugin")) {
5253
pluginFound = true;
5354

5455
logger.debug("gitflow-helper-maven-plugin found in project: [" + project.getName() + "]");
5556

5657
if (masterBranchPattern == null) {
57-
masterBranchPattern = extractMasterBranchPattern(plugin.getConfiguration());
58-
for (int i = 0; i < plugin.getExecutions().size() && masterBranchPattern == null; i++) {
59-
masterBranchPattern = extractMasterBranchPattern(plugin.getExecutions().get(i).getConfiguration());
60-
}
58+
masterBranchPattern = extractPluginConfigValue("masterBranchPattern", plugin);
6159
}
6260

6361
if (gitBranchExpression == null) {
64-
gitBranchExpression = extractGitBranchExpression(plugin.getConfiguration());
65-
for (int i = 0; i < plugin.getExecutions().size() && gitBranchExpression == null; i++) {
66-
gitBranchExpression = extractGitBranchExpression(plugin.getExecutions().get(i).getConfiguration());
67-
}
62+
gitBranchExpression = extractPluginConfigValue("gitBranchExpression", plugin);
6863
}
6964

70-
// Don't drop the maven-deploy-plugin. Read it's config.
65+
// Don't drop the maven-deploy-plugin
7166
} else if (plugin.getKey().equals("org.apache.maven.plugins:maven-deploy-plugin")) {
7267
logger.debug("gitflow-helper-maven-plugin removing plugin: " + plugin + " from project: " + project.getName());
7368
} else {
@@ -108,17 +103,17 @@ public void afterProjectsRead(MavenSession session) throws MavenExecutionExcepti
108103
}
109104
}
110105

111-
private String extractMasterBranchPattern(Object configuration) {
112-
try {
113-
return ((Xpp3Dom) configuration).getChild("masterBranchPattern").getValue();
114-
} catch (Exception ex) {
106+
private String extractPluginConfigValue(String parameter, Plugin plugin) {
107+
String value = extractConfigValue(parameter, plugin.getConfiguration());
108+
for (int i = 0; i < plugin.getExecutions().size() && value == null; i++) {
109+
value = extractConfigValue(parameter, plugin.getExecutions().get(i).getConfiguration());
115110
}
116-
return null;
111+
return value;
117112
}
118113

119-
private String extractGitBranchExpression(Object configuration) {
114+
private String extractConfigValue(String parameter, Object configuration) {
120115
try {
121-
return ((Xpp3Dom) configuration).getChild("gitBranchExpression").getValue();
116+
return ((Xpp3Dom) configuration).getChild(parameter).getValue();
122117
} catch (Exception ex) {
123118
}
124119
return null;

src/main/java/com/e_gineering/maven/gitflowhelper/RetargetDeployMojo.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,9 +43,11 @@ protected void execute(final GitBranchType type, final String gitBranch, final S
4343
break;
4444
}
4545
default: {
46-
getLog().info("Un-Setting artifact repositories");
46+
getLog().info("Un-Setting artifact repositories.");
4747
project.setSnapshotArtifactRepository(null);
4848
project.setReleaseArtifactRepository(null);
49+
project.getProperties().put("maven.deploy.skip", "true");
50+
getLog().info("Setting maven.deploy.skip = 'true'");
4951
break;
5052
}
5153
}

0 commit comments

Comments
 (0)