Watch
2
0
Fork
You've already forked verona
0
Semantic versioning types
  • Java 99.8%
  • CSS 0.2%
Find a file
Repository files (latest commit first)
Filename Latest commit message Latest commit date
2026-07-31 18:43:01 +01:00
.forgejo Update workflows. 2026-07-31 18:43:01 +01:00
com.io7m.verona.core Begin next development iteration. 2026-01-08 12:08:30 +00:00
com.io7m.verona.tests Begin next development iteration. 2026-01-08 12:08:30 +00:00
com.io7m.verona.tests.arbitraries Begin next development iteration. 2026-01-08 12:08:30 +00:00
src/site/resources Update site metadata. 2025-08-09 15:07:20 +00:00
.gitignore Update .gitignore. 2024-05-07 16:01:48 +00:00
.gitmodules Move to new organization. 2024-05-01 22:07:32 +00:00
checkstyle-filter.xml Initial version 2022-11-12 12:44:27 +00:00
checkstyle-suppressions-1.0.dtd Initial version 2022-11-12 12:44:27 +00:00
doc7m-books.json Add doc7m-books.json 2026-07-31 18:36:51 +01:00
pom.xml Migrate project. 2026-06-27 10:14:33 +01:00
README-CHANGES.xml Mark release 1.1.0 2026-01-08 12:08:19 +00:00
README-LICENSE.txt Add LICENSE 2023-08-13 21:04:15 +00:00
README.in Migrate project. 2026-06-27 10:14:33 +01:00
README.md Migrate project. 2026-06-27 10:14:33 +01:00

verona

Maven Central Maven Central (snapshot) Java Version

com.io7m.verona

verona

The verona package provides types implementing the Semantic Versioning specification.

Features

  • Types for representing versions and version ranges.
  • Parsers for version numbers and version ranges.
  • Written in pure Java 17.
  • OSGi ready.
  • JPMS ready.
  • ISC license.
  • High-coverage automated test suite.

Description

Types

The verona package contains types for representing versions and version ranges.

assert Version.of(1, 0, 2).toString() == "1.0.2";
assert Version.of(2, 3, 1, "SNAPSHOT").toString() == "2.3.1-SNAPSHOT";
assert Version.of(3, 0, 0, "SNAPSHOT").toString() == "2.3.1-SNAPSHOT";

Values of type Version are comparable and are ordered such that version number components are treated as unsigned values and, for two versions x and y:

Comparator.comparing(Version::major, COMPARE_UNSIGNED)
  .thenComparing(Version::minor, COMPARE_UNSIGNED)
  .thenComparing(Version::patch, COMPARE_UNSIGNED)
  .thenComparing(Version::qualifier, COMPARE_QUALIFIER)
  .compare(x, y);

For a given version x.y.z, the version x.y.z-q is considered less than x.y.z for any q.

Parsing

Version numbers can be parsed:

assert VersionParser.parse("1.0.2").toString() == "1.0.2";

Parsing is strict by default. This means that exactly three version number components must be provided, along with an optional qualifier. Support is provided for lax parsing that allows for missing components. For example:

assert VersionParser.parse("1.2.0").toString() == "1.2.0";

VersionParser.parse("1.2"); // throws VersionException

assert VersionParser.parseLax("1.2").toString() == "1.2.0";

Additional support is provided for OSGi version numbers where the qualifier is separated with a dot instead of a hyphen:

assert VersionParser.parseOSGi("1.2.0.SNAPSHOT").toString() == "1.2.0-SNAPSHOT";