Class MavenVersion
java.lang.Object
network.ike.workspace.MavenVersion
Validated Maven version value — the
<version> string for
any Maven coordinate, including workspace-root, subproject, and
parent versions (ike-issues#295).
Per feedback_no_semver_assumption, this type does NOT
enforce semver. IKE versions are most commonly single-segment
monotonic (1, 133, 133-SNAPSHOT); some
downstream artifacts use semver-like (1.0.0-SNAPSHOT,
1.127.2-feature-x-SNAPSHOT); calendar-based versions
(20240315-SNAPSHOT) are also valid. The validator accepts
any of these.
Validation rules:
- Non-empty
- Starts with a letter or digit
- Allowed characters: ASCII letters, digits,
.,-,_,+ - No whitespace or shell-metacharacter hazards
(
<,>,",',$, backtick, etc.) — those would be dangerous to interpolate into a POM.
Single typed entry point so every consumer of a version
argument (ws:scaffold-init -Dversion=…,
ws:scaffold-publish -DparentVersion=…,
ws:release -DreleaseVersion=…,
ws:post-release -DnextVersion=…) gets identical validation.
-
Method Summary
Modifier and TypeMethodDescriptionbooleaninthashCode()booleanWhether this version ends in-SNAPSHOT— the standard Maven SNAPSHOT marker.static MavenVersionValidaterawand wrap it as aMavenVersion.toString()value()The validated version as a string.
-
Method Details
-
of
Validaterawand wrap it as aMavenVersion.- Parameters:
raw- the candidate version string (typically from a-Dversion=…or-D<x>.version=…command-line argument, or aworkspace.yamlfield)- Returns:
- a validated
MavenVersion - Throws:
IllegalArgumentException- ifrawis null, empty, or violates any documented rule
-
value
The validated version as a string.- Returns:
- the raw value (never null or empty)
-
isSnapshot
public boolean isSnapshot()Whether this version ends in-SNAPSHOT— the standard Maven SNAPSHOT marker.- Returns:
- true iff the version is a SNAPSHOT
-
equals
-
hashCode
-
toString
-