Java-Semver is a lightweight, zero-dependency Java library that provides full support for Semantic Versioning 2.0.0. Designed for simplicity and reliability, it enables parsing and comparing semantic versions (major.minor.patch-preRelease+build
) effortlessly. Perfect for applications requiring precise version management.
- Full SemVer 2.0.0 Compliance: Strict adherence to the official specification.
- Zero Dependencies: Lightweight and self-contained.
- Java 8+ compatible: Compatible with legacy and modern Java projects.
- Simple API: Intuitive methods for parsing and comparing versions.
- Error Handling: Gracefully handles invalid versions through exceptions.
- Well-tested: Robust JUnit test coverage ensures reliability.
- Pre-release & Build Metadata: Supports
1.0.0-alpha+001
and other complex formats.
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;
final Version currentVersion = Version.of("1.0.0-RC.1+5");
final Version latestVersion = Version.of("2.0.0-beta+exp.sha.5114f85");
Version.isNewer(currentVersion, latestVersion); // false
Version.isNewerOrEqual(currentVersion, latestVersion); // false
Version.isEqual(currentVersion, latestVersion); // false
Version.isOlderOrEqual(currentVersion, latestVersion); // true
Version.isOlder(currentVersion, latestVersion); // true
git clone https://github.com/milkdrinkers/Java-Semver.git
cd javasemver
./gradlew publishToMavenLocal
Contributions 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!)