|
16 | 16 | package com.amashchenko.maven.plugin.gitflow; |
17 | 17 |
|
18 | 18 | import java.util.Arrays; |
| 19 | +import java.util.HashMap; |
| 20 | +import java.util.Map; |
19 | 21 |
|
| 22 | +import org.apache.maven.artifact.Artifact; |
| 23 | +import org.apache.maven.artifact.ArtifactUtils; |
20 | 24 | import org.apache.maven.plugin.MojoExecutionException; |
21 | 25 | import org.apache.maven.plugin.MojoFailureException; |
22 | 26 | import org.apache.maven.plugins.annotations.Mojo; |
@@ -56,6 +60,13 @@ public class GitFlowSupportStartMojo extends AbstractGitFlowMojo { |
56 | 60 | @Parameter(property = "supportBranchName") |
57 | 61 | private String supportBranchName; |
58 | 62 |
|
| 63 | + /** |
| 64 | + * Whether to use snapshot in support. |
| 65 | + * |
| 66 | + */ |
| 67 | + @Parameter(property = "useSnapshotInSupport", defaultValue = "false") |
| 68 | + private boolean useSnapshotInSupport; |
| 69 | + |
59 | 70 | /** {@inheritDoc} */ |
60 | 71 | @Override |
61 | 72 | public void execute() throws MojoExecutionException, MojoFailureException { |
@@ -113,6 +124,20 @@ public void execute() throws MojoExecutionException, MojoFailureException { |
113 | 124 | // git checkout -b ... tag |
114 | 125 | gitCreateAndCheckout(gitFlowConfig.getSupportBranchPrefix() + branchName, tag); |
115 | 126 |
|
| 127 | + if (useSnapshotInSupport) { |
| 128 | + String version = getCurrentProjectVersion(); |
| 129 | + if (!ArtifactUtils.isSnapshot(version)) { |
| 130 | + version = version + "-" + Artifact.SNAPSHOT_VERSION; |
| 131 | + |
| 132 | + mvnSetVersions(version); |
| 133 | + |
| 134 | + Map<String, String> properties = new HashMap<String, String>(); |
| 135 | + properties.put("version", version); |
| 136 | + |
| 137 | + gitCommit(commitMessages.getSupportStartMessage(), properties); |
| 138 | + } |
| 139 | + } |
| 140 | + |
116 | 141 | if (installProject) { |
117 | 142 | // mvn clean install |
118 | 143 | mvnCleanInstall(); |
|
0 commit comments