To make the install4j task available to ant, you must first insert a taskdef element that tells ant where to find the task definition. Here is an example of using the task in an ant build file:
<taskdef name="install4j"
classname="com.install4j.Install4JTask"
classpath="C:\Program Files\install4j\bin\ant.jar"/>
<target name="media">
<install4j projectfile="myapp.install4j"/>
</target>
The taskdef definition must occur only once per ant-build file and can appear anywhere on the top level below the project element.
Note: it is not possible to copy the ant.jar archive to the lib folder of your ant distribution. You have to reference a full installation of install4j in the task definition.
| Attribute | Description | Required |
|---|---|---|
| projectfile | The install4j project file that should be build. | Yes |
| verbose | Corresponds to the --verbose command line option. Either true or false. | No, verbose and quiet cannot both be true |
| quiet | Corresponds to the --quiet command line option. Either true or false. | |
| test | Corresponds to the --test command line option. Either true or false. | No |
| release | Corresponds to the --release command line option. Enter a version number like "3.1.2". The version number may only contain numbers and dots. | No |
| destination | Corresponds to the --destination command line option. Enter a directory where the generated media files should be placed. | No |
| buildselected | Corresponds to the --build-selected command line option. Either true or false. | No |
| buildids | Corresponds to the --build-ids command line option. Enter a list of media file ids. The IDs for media files can be shown in the install4j GUI by choosing Media->Show media file IDs from the main menu when the media file step is visible. | No |
| mediatypes | Corresponds to the --media-types command line option. Enter a list of media types. To see the list of supported media types, execute install4jc --list-media-types. | No |
| variablefile | Corresponds to the --var-file command line option. Enter the name of file with variable definitions. | No |
Contained elements:
The install4j task can contain variable elements.
These elements override user variables
in the project and correspond to the -D
command line option. Definitions with
variable elements take precedence before definitions in
the variable file referenced by the variablefile parameter.
The variable element supports the following parameters:
| Attribute | Description | Required |
|---|---|---|
| name | The name of the variable. This must be the name of a variable that has been defined on the user variables tab of the general settings step. | Yes |
| value | The value for the variable. The value may be empty. | Yes |
| mediafileid | The ID of the media file for which the variable should be overridden. The IDs for media files can be shown in the install4j GUI by choosing Media->Show media file IDs from the main menu when the media file step is visible. | No |
Example:
<install4j projectfile="myapp.install4j">
<variable name="MYVARIABLE" value="15"/>
<variable name="OTHERVARIABLE" value="test" mediafileid="8"/>
</install4j>