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";
Releases & Development Snapshots
Releases
You can subscribe to the atom feed to be notified of project releases.
The most recently released version of the package is 1.0.1.
1.0.1 Release (2024-05-11Z)
- Update org.junit.jupiter:junit-jupiter-api:5.10.1 → 5.10.2.
- Update net.jqwik:jqwik-engine:1.8.2 → 1.8.4.
- Update net.jqwik:jqwik-api:1.8.2 → 1.8.4.
- Update org.junit.jupiter:junit-jupiter-engine:5.10.1 → 5.10.2.
- Move to new organization.
The compiled artifacts for the release (and all previous releases) are available on Maven Central.
Maven Modules
<dependency> <group>com.io7m.verona</group> <artifactId>com.io7m.verona.core</artifactId> <version>1.0.1</version> </dependency><dependency> <group>com.io7m.verona</group> <artifactId>com.io7m.verona.tests</artifactId> <version>1.0.1</version> </dependency>
Previous Releases
The changelogs for the most recent previous releases are as follows:
1.0.0 Release (2023-04-22Z)
Development Snapshots
At the time of writing, the current unstable development version of the package is 1.0.2-SNAPSHOT.
Development snapshots may be available in the Central Portal Snapshots repository. Snapshots are published to this repository every time the project is built by the project's continuous integration system, but snapshots do expire after around ninety days and so may or may not be available depending on when a build of the package was last triggered.
Manual
This project does not have any user manuals or other documentation beyond what might be present on the page above.
Sources
This project uses Git to manage source code.
Repository: https://www.github.com/io7m-com/verona
$ git clone --recursive https://www.github.com/io7m-com/verona
Issues
This project uses GitHub Issues to track issues.
License
Copyright © 2023 Mark Raynsford <code@io7m.com> https://www.io7m.com Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted, provided that the above copyright notice and this permission notice appear in all copies. THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.