Skip to content

Commit c57fbe6

Browse files
committed
+ better names
1 parent e8f9466 commit c57fbe6

File tree

3 files changed

+19
-20
lines changed

3 files changed

+19
-20
lines changed

README.md

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,15 @@ file according to the [Semantic Versioning 2.0.0](https://semver.org/) specifica
77

88
## User story
99

10-
As a user of this Maven Plugin, I want to update my project's version in the local pom.xml file according
10+
As a user of this Maven Plugin, I want to update my project's version in the local `pom.xml` file according
1111
to the Semantic Versioning 2.0.0 specifications, by issuing Maven commands from CLI or build script/code.
1212

1313
_Notes:_
1414

1515
- Unlike some other Maven versioning plugins, this one does not try to include or combine any extra functionalities
1616
beyond local POM version change. In and of itself, for example, the plugin does not communicate with any version
1717
control system or artifact repository: It has one single concern - the project's version as defined in the local
18-
pom.xml file.
18+
`pom.xml` file.
1919
- Command-line-invokable as an atomic and composable action/step, the plugin aims to suit whatever CI/CD pipeline
2020
workflow one may care to set up by script/code.
2121

@@ -25,25 +25,24 @@ Maven 3.5.4 or better
2525

2626
## Get it...
2727

28-
To include in pom.xml:
28+
Include this plugin in `pom.xml`:
2929

3030
```
31-
...
3231
<build>
3332
<plugins>
3433
<plugin>
3534
<groupId>io.github.q3769</groupId>
3635
<artifactId>semver-maven-plugin</artifactId>
36+
<version>${latest.version}</version>
3737
</plugin>
38-
...
3938
```
4039

4140
## Use it...
4241

43-
_Note:_ By default, only the parent project's version is processed, module versions are not. Use
42+
_Note:_ By default, only the parent project's version is processed, module versions are not. Use
4443
the `-DprocessModule` command flag if you also wish to process modules.
4544

46-
From CLI, assuming you are in the Maven project's default root directory where the pom.xml file is located:
45+
From CLI, assuming you are in the Maven project's default root directory where the `pom.xml` file is located:
4746

4847
### Hard set
4948

@@ -57,7 +56,7 @@ errors out because `blah` is not a valid SemVer
5756
mvn semver:set-current -Dsemver=1.2.3-beta
5857
```
5958

60-
sets the new value of the version element of the pom.xml file to be `1.2.3-beta`, regardless of the original value in
59+
sets the new value of the version element of the `pom.xml` file to be `1.2.3-beta`, regardless of the original value in
6160
POM
6261

6362
### Increment normal version number
@@ -163,7 +162,7 @@ updates `1.2.0-SNAPSHOT+chi.1` into `1.4.0-SNAPSHOT+chi.1`, where `1.2.0-SNAPSHO
163162
- This merge strategy is opinionated. The SemVer spec itself only defines the order of precedence among versions, and
164163
does not mention merging.
165164

166-
The basic idea here is to center the merge process around the current version in the pom.xml file. I.e., the intents and
165+
The basic idea here is to center the merge process around the current version in the `pom.xml` file. I.e., the intents and
167166
purposes of the current POM version will dominate those of the given SemVer to merge.
168167

169168
1. Take the newer between the current POM version and the given version to merge, according to the SemVer precedence.
@@ -212,6 +211,6 @@ prints confirmation message if the current version of the local POM is in valid
212211
mvn semver:verify-current -Dforce-stdout -q
213212
```
214213

215-
prints the current POM version and nothing else (e.g. `1.2.3-beta.4+build.5`) in std out if it is a valid SemVer.
216-
For a clean print out of the project's SemVer with nothing else, you need the `-q` or `--quiet` option to suppress
214+
prints the current POM version and nothing else (e.g. `1.2.3-beta.4+build.5`) in std out if it is a valid SemVer.
215+
For a clean print out of the project's SemVer with nothing else, you need the `-q` or `--quiet` option to suppress
217216
the usual Maven messages.

pom.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030

3131
<groupId>io.github.q3769</groupId>
3232
<artifactId>semver-maven-plugin</artifactId>
33-
<version>20240116.0.202408090440</version>
33+
<version>20240116.0.202408090559</version>
3434
<packaging>maven-plugin</packaging>
3535

3636
<name>semver-maven-plugin</name>
@@ -229,7 +229,7 @@
229229
<plugin>
230230
<groupId>io.github.q3769</groupId>
231231
<artifactId>semver-maven-plugin</artifactId>
232-
<version>20240116.0.202408090440</version>
232+
<version>20240116.0.202408090559</version>
233233
</plugin>
234234
<plugin>
235235
<groupId>org.apache.maven.plugins</groupId>

src/main/java/q3769/maven/plugins/semver/mojos/CalendarVersionFormatter.java

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -51,25 +51,25 @@ enum CalendarVersionFormatter {
5151

5252
/**
5353
* @param original pom version
54-
* @param originalNormalVersion to increment
54+
* @param selectedNormalVersion to increment
5555
* @return new instance incremented
5656
* @throws MojoFailureException if the original version's target category version is newer than
5757
* now
5858
*/
5959
public static Version calendarIncrement(
60-
Version original, @Nonnull SemverNormalVersion originalNormalVersion)
60+
Version original, @Nonnull SemverNormalVersion selectedNormalVersion)
6161
throws MojoFailureException {
62-
long originalNormalVersionNumber = originalNormalVersion.getNormalVersionNumber(original);
62+
long selectedNormalVersionNumber = selectedNormalVersion.getNormalVersionNumber(original);
6363
Instant now = Instant.now();
6464
for (CalendarVersionFormatter formatter : values()) {
6565
long updatedNormalVersionNumber = formatter.format(now);
66-
if (updatedNormalVersionNumber > originalNormalVersionNumber) {
67-
return originalNormalVersion.incrementTo(updatedNormalVersionNumber, original);
66+
if (updatedNormalVersionNumber > selectedNormalVersionNumber) {
67+
return selectedNormalVersion.incrementTo(updatedNormalVersionNumber, original);
6868
}
6969
}
7070
throw new MojoFailureException(new UnsupportedOperationException(String.format(
71-
"%s version %s in original semver %s is not supported for calendar style increment - it has to be older than current date in UTC zone",
72-
originalNormalVersion, originalNormalVersionNumber, original)));
71+
"%s version %s in POM semver %s is not supported for calendar style increment - it has to be older than current date in UTC zone",
72+
selectedNormalVersion, selectedNormalVersionNumber, original)));
7373
}
7474

7575
private DateTimeFormatter getDateTimeFormatter() {

0 commit comments

Comments
 (0)