Create, Parse, and Validate Semantic Version 2.0.0 strings.
To use this library, add following dependency to your project -
<dependency>
<groupId>com.github.manikmagar</groupId>
<artifactId>semver4j</artifactId>
<version>${semver4j.version}</version>
</dependency>
implementation 'com.github.manikmagar:semver4j:${semver4j.version}'
-
✓ Create Semantic core version (eg. 1.2.3)
-
✓ Increment core Versions, examples:
-
1.2.3 → 1.2.4
-
1.2.3 → 1.3.0
-
1.2.3 → 2.0.0
-
-
✓ Validate core version
-
✓ Add valid Prerelease identifiers, examples:
-
1.2.3-alpha.1
-
1.2.3-alpha.release.1
-
-
✓ Add build metadata
-
1.2.3+build.1
-
1.2.3+build.commit.1
-
-
❏ Compare Semantic versions based on specification precedence
-
❏ Parse Semantic Version strings
Check SemVerTest.java for all usage examples.
//Build Version 1.2.3-Alpha+Build-01
var version = new SemVer(1, 2, 3)
.with(prerelease("Alpha"))
.with(build("Build-01"))
System.out.println(version.toString())
Run the following command to build this project:
./mvnw verify
Pass the -Dquick
option to skip all non-essential plug-ins and create the output artifact as quickly as possible:
./mvnw verify -Dquick
Run the following command to format the source code and organize the imports as per the project’s conventions:
./mvnw compile -Dformat=true
This code base is available under the Apache License, version 2.