@@ -19,10 +19,16 @@ public class SemanticVersionMojo extends AbstractMojo {
19
19
@ Component private MavenProject project ;
20
20
21
21
@ Parameter (
22
- property = "updatePomWithNextSemanticVersionSuffixSnapshot" ,
22
+ property = "updatePomWithCurrentSemanticVersionSuffixSnapshot" ,
23
+ required = false ,
24
+ defaultValue = "false" )
25
+ private boolean updatePomWithCurrentSemanticVersionSuffixSnapshot ;
26
+
27
+ @ Parameter (
28
+ property = "updatePomWithCurrentSemanticVersionSuffixSnapshotIfNotTagged" ,
23
29
required = false ,
24
30
defaultValue = "true" )
25
- private boolean updatePomWithNextSemanticVersionSuffixSnapshot ;
31
+ private boolean updatePomWithCurrentSemanticVersionSuffixSnapshotIfNotTagged ;
26
32
27
33
@ Parameter (property = "semanticMajorVersionPattern" , required = false )
28
34
private String semanticMajorVersionPattern ;
@@ -52,9 +58,14 @@ public void execute() throws MojoExecutionException {
52
58
if (this .isSupplied (this .ignoreTagsIfNameMatches )) {
53
59
gitChangelogApiBuilder .withIgnoreTagsIfNameMatches (this .ignoreTagsIfNameMatches );
54
60
}
55
- final SemanticVersion nextSemanticVersion = gitChangelogApiBuilder .getNextSemanticVersion ();
61
+ final SemanticVersion nextSemanticVersion =
62
+ gitChangelogApiBuilder .getCurrentSemanticVersion ();
63
+ final boolean notTagged = nextSemanticVersion .findTag ().isEmpty ();
64
+ final boolean suffixWithSnapshot =
65
+ this .updatePomWithCurrentSemanticVersionSuffixSnapshot
66
+ || this .updatePomWithCurrentSemanticVersionSuffixSnapshotIfNotTagged && notTagged ;
56
67
final String nextVersion =
57
- this . updatePomWithNextSemanticVersionSuffixSnapshot
68
+ suffixWithSnapshot
58
69
? nextSemanticVersion .getVersion () + "-SNAPSHOT"
59
70
: nextSemanticVersion .getVersion ();
60
71
0 commit comments