Skip to content

Latest commit

 

History

History
95 lines (76 loc) · 2.46 KB

README.adoc

File metadata and controls

95 lines (76 loc) · 2.46 KB

Semantic Version for Java

Release Build Status GitHub Javadoc

Create, Parse, and Validate Semantic Version 2.0.0 strings.

Dependency

To use this library, add following dependency to your project -

Maven Dependency
<dependency>
  <groupId>com.github.manikmagar</groupId>
  <artifactId>semver4j</artifactId>
  <version>${semver4j.version}</version>
</dependency>
Gradle Dependency
implementation 'com.github.manikmagar:semver4j:${semver4j.version}'

Feature Implementation

  • ✓ 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

Usage

Check SemVerTest.java for all usage examples.

SemVer Example
//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())

Build

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

License

This code base is available under the Apache License, version 2.