# CompareVersions Condition

# Usage

TheÂ *CompareVersions*Â condition (`type="`

) 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.*compareversions*"

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

*would result in comparing*

`1.0.1`

*and*

`1.0.0`

*, thus evaluating*

`1.0.1`

*.*

`1.0 < 1.0.1`

In comparison, there is implementedÂ a second condition of type "

"Â whichÂ comparing just the most common denominator of the major version parts of both sides.*compareversionsmajor*

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 (>)