A Java API for parsing and checking Semantic Versioning.
- Version parsing
- Version comparison
- Compatibility check
- Version adjustment (increment, build, tag, release);
The SemVer-J API is intended to be a standalone API for version comparison. No dependencies. You should depend on it ;)
Creating a new version
SemVer version = SemVer.of(1, 0, 0);
// Use the information
version.getMajor(); // 1
version.getMinor(); // 0
version.getPatch(); // 0
SemVer another = SemVer.parse("1.1.0");
// Version comparison
version.isNewerThan(another); // false
version.isOlderThan(another); // true
version.isCompatibleWith(another); // false
another.isCompatibleWith(version); // true
If you find any issues please report them or better, send a pull request.
- Christian Hartung