A modern & lightweight Java library providing full Semantic Versioning 2.0.0 specification compliance. Designed as a port of the javascript ecosystems Node Semver, it ports all major features of Node Semver to native Java.
- Full SemVer 2.0.0 Compliance: Adherence to the official specification.
- Zero Dependencies: Lightweight and self-contained.
- Java 8+ compatible: Compatible with legacy and modern Java projects.
- Node Semver Features Ported:
- Parsing
- Comparisons
- Ranges
- Incrementing
- Coercion
- Well-tested: Extensive test coverage, including parity tests with node-semver.
Add Java-Semver to your project with Maven or Gradle:
Gradle Kotlin DSL
repositories {
mavenCentral()
}
dependencies {
implementation("io.github.milkdrinkers:javasemver:LATEST_VERSION")
}Maven
<project>
<dependencies>
<dependency>
<groupId>io.github.milkdrinkers</groupId>
<artifactId>javasemver</artifactId>
<version>LATEST_VERSION</version>
</dependency>
</dependencies>
</project>import io.github.milkdrinkers.javasemver.Version;
import io.github.milkdrinkers.javasemver.enums.ReleaseType;
// Parsing and comparisons
final Version current = Version.parse("1.0.0-rc.1+5");
final Version latest = Version.parse("2.0.0-beta+exp.sha.5114f85");
current.isLessThan(latest); // true
current.isGreaterThan(latest); // false
current.isEqualTo(latest); // false
// Ranges
Version.parse("1.2.3").satisfies("^1.0.0"); // true
Version.parse("2.0.0").satisfies(">=1.0.0 <2.0.0"); // false
// Incrementing
Version.parse("1.2.3").increment(ReleaseType.MINOR); // 1.3.0
Version.parse("1.2.3").nextPatch(); // 1.2.4
// Coerceion
Version.coerce("release-v1.2"); // Optional wrapped 1.2.0git clone https://github.com/milkdrinkers/Java-Semver.git
cd javasemver
./gradlew publishToMavenLocalContributions are always welcome! Please make sure to read our Contributor's Guide for standards and our Contributor License Agreement (CLA) before submitting any pull requests.
We also ask that you adhere to our Contributor Code of Conduct to ensure this community remains a place where all feel welcome to participate.
You can find the license the source code and all assets are under here. Additionally, contributors agree to the Contributor License Agreement (CLA) found here.
Here is a list of known projects using Java-Semver:
- Minecraft-Plugin-Template - Provided by default in a Minecraft Plugin Template.
- VersionWatch - A lightweight library that simplifies version monitoring across popular software distribution platforms..
- Maquillage - Maquillage a Minecraft cosmetics plugin.
- Stewards - Stewards a Minecraft Towny NPC extension plugin.
- CharacterCards - CharacterCards is a Minecraft plugin allowing players to create cards describing their character.
- (Add your project here!)
