Class MavenVersion

java.lang.Object
network.ike.workspace.MavenVersion

public final class MavenVersion extends Object
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 Details

    • of

      public static MavenVersion of(String raw)
      Validate raw and wrap it as a MavenVersion.
      Parameters:
      raw - the candidate version string (typically from a -Dversion=… or -D<x>.version=… command-line argument, or a workspace.yaml field)
      Returns:
      a validated MavenVersion
      Throws:
      IllegalArgumentException - if raw is null, empty, or violates any documented rule
    • value

      public String 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

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object