Skip to content
Semantic versioning framework in Kotlin
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.
gradle/wrapper Add gradle-wrapper.jar Mar 9, 2019
lint Add detekt Mar 8, 2019
src Add test cases. Mar 21, 2019
.gitignore Import .gitignore Mar 5, 2019
LICENSE Initial commit Jan 20, 2019 Update Mar 19, 2019
build.gradle.kts Bump version to 1.0.1 Mar 21, 2019
gradlew Initialize gradle Mar 5, 2019
gradlew.bat Initialize gradle Mar 5, 2019
settings.gradle.kts Implement tests Mar 6, 2019

Kotlin Build Status Codecov

Semantic Versioning

Semantic Versioning implementation in Kotlin. Semver represents the versioning system specified in Semantic Versioning Specification.


Semver requires no external dependencies. You can install the library via:


// build.gradle
repositories {
dependencies {
    implementation 'com.github.glwithu06.semver:semver:x.y.z'


// build.gradle
repositories {
    maven { url '' }
dependencies {
    implementation 'com.github.glwithu06:semver.kt:x.y.z'



You can create a Semver instance like the following:

val version = Semver(major = 1, minor = 23, patch = 45, prereleaseIdentifiers = listOf("rc", "1"), buildMetadataIdentifiers = listOf("B001"))

minor, patch are optional parameters and set to "0" by default.

prereleaseIdentifiers, buildMetadataIdentifiers are optional parameters and set to empty lists by default.


You can create Semver from String:

val version = Semver("1.23.45-rc.1+B001")

or from Numeric:

val version = Semver(1.23)
val version = Semver(10)

If the given argument has an invalid format, it throws a IllegalArgumentException.


Semver class implements Comparable interface and overrides equals(), so their instances can be compared using the default operators including < , <= , > ,>= ,== , !=.

The comparison rules are specified in Semantic Versioning Specification.


Pull requests and bug reports are welcomed!

Feel free to make a pull request.

You can’t perform that action at this time.