/
CompareVersions Condition

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:

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

The CompareVersions condition has been introduced in IzPack 5.0.

Nested Elements

arg1

This is a mandatory nested element, defining the left version to compare. Any string is allowed, IzPack will try to resolve it as a version string.

arg2

This is a mandatory nested element, defining the right version to compare. Any string is allowed, IzPack will try to resolve it as a version string.

operator

This is a mandatory nested element, specifying the comparison operation to apply

Allowed values:

  • eq - check whether both versions are equal (=)
  • ne - check whether both versions differ (not equal) (<>)
  • leq - check whether the left version is less than or equal the right version (<=)
  • lt - check whether the left version is less than the right version (<)
  • geq - check whether the left version is greater than or equal the right version (>=)
  • gt - check whether the left version is greater than the right version (>)

Related content

Contains Condition
Contains Condition
More like this
Java Condition
Java Condition
More like this
Predefined Conditions
Predefined Conditions
Read with this
CompareVersionsMajor Condition
CompareVersionsMajor Condition
More like this
Exists Condition
Exists Condition
Read with this
CompareNumerics Condition
CompareNumerics Condition
More like this