We need you!

Icon

The IzPack documentation needs work, and you are invited to edit it!

Versions Compared

Key

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

Compile-time Properties - <properties>

Understanding Properties

IzPack properties are key-value pairs that can be used for substitution during the compilation phase, only. The scope makes the difference to variables, which are evaluated and can be seen also during the installation phase. IzPack properties will not be visible during the execution of the compiled installer.

Properties cannot be re-defined and will not be overwritten, once there exists a property with the same key.

Using Properties

Properties can be explicitely set in the installer descriptor. Additionally, IzPack sets different kinds of built-in properties depending on how the compilation is launched

Setting Properties

Explicit Properties

Explicit properties can be defined by the user using the <properties> tag in the installation description.

Example:

Code Block
titleinstall.xml
languagehtml/xml
<properties>
  <property name="info.appName" value="My Application"/>
  <property name="info.appsubpath" value="my-company/my-app"/>
  <property name="info.url" value="http://www.my-company.com"/>
  <property name="info.company.name" value="My Company Name"/>
  <property name="info.company.email" value="info@my-company.com"/>
</properties>

Maven Properties

When launching the compilation using the IzPack Maven plugin, there are automatically added all Maven project properties as available properties in IzPack. Maven properties have priority over explicit properties, since they are set during instantiation of the IzPack compiler, before the IzPack compilation starts.

This behavior of defining implicit properties is similar than setting implicit Ant project properties in IzPack 4.X.

Example:

Code Block
titlePOM
languagehtml/xml
<properties>
  <!-- Installer variables -->
  <info.appName>My Application</info.appName>
  <info.appsubpath>my-company/my-app</info.appsubpath>
  <info.url>www.my-company.com</info.url>
  <info.company.name>My Company Name</info.company.name>
  <info.company.email>info@my-company.com</info.company.email>
</properties>

Reading/Substituting Properties

IzPack properties can be accessed for reading in the installation descriptor by a leading 'at' placeholder followed by the property name (for example @my.prop.name). Optionally, when embedding property substitution into text which continues without a whitespace character, the key can be embedded in braces opening after the 'at' (for example @{my.prop.name}).

IzPack properties are substituted when there definition can be found in the installation descriptor XML inside of

  • element attribute values,
  • embedded (enclosed) content.

Example:

 

Code Block
titleinstall.xml
languagehtml/xml
<info>
  <appname>@{info.appName}</appname>
  <appsubpath>@{info.appsubpath}</appsubpath>
  <appversion>@{project.version}</appversion>
  <authors>
    <author name="@{info.company.name}" email="@{info.company.email}"/>
  </authors>
  <url>@{info.url}</url>
  ...
</info>