https://github.com/jagodevreede/semver-check
A maven plugin that allows you to check (or determine) the next version of your module, based on the rules of Semantic Versioning.
https://github.com/jagodevreede/semver-check
java maven-plugin semantic-versioning semver
Last synced: 5 months ago
JSON representation
A maven plugin that allows you to check (or determine) the next version of your module, based on the rules of Semantic Versioning.
- Host: GitHub
- URL: https://github.com/jagodevreede/semver-check
- Owner: jagodevreede
- License: apache-2.0
- Created: 2022-11-17T20:37:46.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2026-01-12T23:00:14.000Z (5 months ago)
- Last Synced: 2026-01-13T00:38:25.437Z (5 months ago)
- Topics: java, maven-plugin, semantic-versioning, semver
- Language: Java
- Homepage:
- Size: 301 KB
- Stars: 31
- Watchers: 1
- Forks: 3
- Open Issues: 5
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# SemVer check



This maven plugin allows you to check (or determine) the next version of your module, based on the rules
of [Semantic Versioning](https://semver.org/).
## Prerequisites
This plugin requires Maven 3.3.9 and Java 11 or higher to be able to run.
Tested working on maven 4-RC4 and JDK 25.
## Usage
There is an [example project](semver-check-maven-plugin-example) that has a minimum configuration but all options
specified.
Add the following configuration to your `pom.xml` and set the VERSION_NUMBER to the latest version released.
```xml
...
...
semver-check-maven-plugin
io.github.jagodevreede
VERSION_NUMBER
true
nextVersion.txt
check
verify
check
...
...
```
This plugin can be used with a multimodule project, an example project can be
found [here](https://github.com/jagodevreede/semver-check/tree/main/semver-check-maven-plugin-multi-module-example).
## Configuration
The following configuration options are available:
| Property name | Default value | Description |
|---------------------------|-------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| skip | `false` | If set to `true` then the build will skip the execution of this plugin |
| skipDependencyCheck | `false` | If set to `true` then the dependencies will not be compared to the previous version |
| haltOnFailure | `true` | If set to `false` then the build will not fail if the plugin encounter a problem, but only log a warning |
| ignoreSnapshots | `true` | If set to `false` then the plugin will also compare to SNAPSHOT versions if it can find any (in local repo's for example) |
| outputFileName | `nextVersion.txt` | The name of the file where the next version in plain text will be written to. This file is located in the `target` folder. If the property is left empty then no file will be created |
| writeFileOnNone | `true` | If set to `false` then the output file will not be written if the determined version upgrade type is `none` |
| overwriteOutputFile | `true` | If set to `false` then the output file will not be overwritten. |
| includePackages | | Only uses packages in the list and ignores any others, can be a comma separated list or a list of includePackage. Values are a regex pattern (See [example project](semver-check-maven-plugin-example) for example) |
| excludePackages | | Ignores packages can be a comma separated list or a list of excludePackage. Values are a regex pattern (See [example project](semver-check-maven-plugin-example) for example) |
| excludeFiles | | Ignores files in match the regex with given here. Can be a comma separated list or a list of excludeFile (See [example project](semver-check-maven-plugin-example) for example) |
| failOnIncorrectVersion | `false` | If set to `true` then if the semver mismatches the build will fail. |
| allowHigherVersions | `true` | Only has effect when `failOnIncorrectVersion` is set. If allowHigherVersions set to `false` it will also break if it detected a is lower then expected version. |
| annotationAddedStrategy | `MINOR` | Strategy to use when an annotation is added. Possible values: MAJOR, MINOR, PATCH, NONE |
| annotationRemovedStrategy | `MAJOR` | Strategy to use when an annotation is removed. Possible values: MAJOR, MINOR, PATCH, NONE. |
## How is the semver type determined
### Major
- Changing the java version of the compiled classes to a higher version.
- Removal of a public class, method, field or static variable.
- Removal of a resource file
- Removal of an annotation on a public API
### Minor
- Addition of a public class, method, annotation, field or static variable.
- Removal of an annotation on a non public API
## Patch
- Any change that changes the byte code
- Any change in a resource file (Note that files in META-INF/maven/ are ignored as they are generated by maven)
- Any change in a dependency
## Known limitations
Java modules (JPMS) are not supported yet, tracked as
issue [#65](https://github.com/jagodevreede/semver-check/issues/65)
## Getting involved
If you have questions, concerns, bug reports, etc, please file an issue in this repository's Issue Tracker, or better
yet create a Pull Request
If you contribute to this project please follow
the [conventional commits](https://www.conventionalcommits.org/en/v1.0.0/) specification for commit messages.
## How to release
All automated with the github release action.
**Prerequisites:**
- Have pgp keys setup on your machine
- Have access to the group id on https://s01.oss.sonatype.org/
- Have [jreleaser](https://jreleaser.org/guide/latest/install.html) installed
First set the correct version to be released:
> ```mvn versions:set -DnewVersion=1.2.3```
Tag this release with tag v1.2.3
Then stage the release:
> ```mvn -Ppublication clean deploy -DaltDeploymentRepository=local::default::file://`pwd`/target/staging-deploy```
The start the actual release:
> ```mvn -Ppublication jreleaser:full-release```
> Add dry drun if you first need to check what it will do:
> `-Djreleaser.dry.run=true`
Lastly set the next snapshot version:
> ```mvn versions:set -DnewVersion=1.2.4-SNAPSHOT```
Close the release in maven central at https://s01.oss.sonatype.org/#stagingRepositories
----
## Open source licensing info
1. [LICENSE](LICENSE)
----