Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

The CompareVersions Condition

...

Usage

The CompareVersions condition (type="compareversions") can be used to find out, how two given version strings relate, comparing all version parts of both sides. If one of both operands has a different number of version parts than the second one the missing version parts ar assumed to be 0 for a complete comparison of all parts beginning from the major version part.

For example, when comparing 1.0 and 1.0.1, the CompareVersions condition assumes missing minor version parts to be 0 effectively, thus comparing 1.0 and 1.0.1 would result in comparing 1.0.0 and 1.0.1, thus evaluating 1.0 < 1.0.1.

In comparison, there is implemented a second condition of type "compareversionsmajor" which comparing just the most common denominator of the major version parts of both sides.

Example:

Code Block
<condition type="compareversions" id="isValidWrapperJavaVersion">
    <arg1>${previous.wrapper.java.version}</arg1>
    <arg2>1.5</arg2>
    <operator>geq</operator>
</condition>

...