Version.java#.#.#.# with optional b{beta}, rc{release-candidate}, and -SNAPSHOT suffixes. Implements Comparable<Version> for correct ordering (release > RC > beta, with numeric sub-comparison). Used throughout ProjectForge for plugin compatibility checks and database migration versioning.java.io.Serializable — Versions are serialized (e.g., stored in database plugin version records)org.apache.commons.lang3.StringUtils — String splitting for parsing dotted version componentsorg.slf4j.Logger — Logging via SLF4J (error logging for malformed version strings)Version implements Comparable<Version>, Serializable
</> operators in Kotlin| Component | Field | Default/Unset Value | Example |
|---|---|---|---|
| Major release | majorRelease | 0 | 3.5.4.2 → major=3 |
| Minor release | minorRelease | 0 | 3.5.4.2 → minor=5 |
| Patch level | patchLevel | 0 | 3.5.4.2 → patch=4 |
| Build number | buildNumber | 0 | 3.5.4.2 → build=2 |
| Beta version | betaVersion | Integer.MAX_VALUE (not beta) | 3.5b2 → beta=2 |
| RC version | releaseCandidateVersion | Integer.MAX_VALUE (not RC) | 3.5rc1 → rc=1 |
| Snapshot flag | snapshot | false | 3.5-SNAPSHOT |
The string constructor accepts these patterns (case-insensitive for suffixes):
"3" → major=3"3.5" → major=3, minor=5"3.5.4" → major=3, minor=5, patch=4"3.5.4.2" → major=3, minor=5, patch=4, build=2"3.5b2" or "3.5b" → beta=2 or beta=0"3.5rc1" or "3.5rc" → rc=1 or rc=0"3.5-SNAPSHOT" or "3.5-snapshot" → snapshot=true"3.5.4.2b2-SNAPSHOT"The comparison follows a strict hierarchy:
This ordering ensures: 3.5b1 < 3.5rc1 < 3.5 — critical for determining whether a database migration or plugin upgrade is needed.
The parseInt() method detects the Gradle unexpanded token "gradle.version" and treats it as 0, logging a warning. This handles the case where version information is compiled into a JAR at build time and the Gradle version property hasn't been resolved yet (e.g., in IDE test runs).
3.5 (patch=0, build=0) → "3.5"3.5.4 (patch≠0, build=0) → "3.5.4"3.5.4.2 (all parts) → "3.5.4.2"3.5b2 (beta) → "3.5b2"3.5rc1 (RC) → "3.5rc1"3.5-SNAPSHOT (snapshot) → "3.5-SNAPSHOT"Integer.MAX_VALUE as the sentinel for "not beta/RC" is an elegant design decision. It ensures that in numeric comparison, a non-beta version always compares as higher than any beta version (since MAX_VALUE is the largest possible integer), while still allowing direct numeric comparison when both are beta/RC.compareTo method does NOT consider the snapshot flag in ordering. Two versions differing only by snapshot status (e.g., "3.5" vs "3.5-SNAPSHOT") would compare as equal. This may be intentional — snapshots indicate build-time metadata rather than semantic version differences.868d6abb7 2025 -> 2026 63081666f Source file headers: 2024-> 2025. 0237d5eba Json serialization refactored: IdOnlySerializer and IdsOnlySerializer introduced. 6f7e0fbc7 Migration stuff in progress... b6092df09 Copyright 2023 -> 2024 ab45d51fa Copyright 2001-2022 -> 2001-2023. 5f7ef41b8 Copyright 2021 -> 2022 ceb63e8a1 Source code header: (C) 2001-2021.