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, test and incremental cannot both be true |
incremental | Corresponds to the --incremental command line option. Either true or false. | |
debug | Corresponds to the --debug command line option. Either true or false. | No |
faster | Corresponds to the --faster command line option. Either true or false. | No |
disableSigning | Corresponds to the --disable-signing command line option. Either true or false. | No |
winKeystorePassword | Corresponds to the --win-keystore-password command line option. | No |
macKeystorePassword | Corresponds to the --mac-keystore-password command line option. | No |
release | Corresponds to the --release command line option. Enter a version number like "3.1.2". Version number components can be alphanumeric and should be separated by dots, dashes or underscores. | 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 IDE by choosing Project->Show IDs from the main menu. | 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 compiler 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 Compiler 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 IDE by choosing Project->Show IDs from the main menu. | No |
Example:
<install4j projectfile="myapp.install4j"> <variable name="MYVARIABLE" value="15"/> <variable name="OTHERVARIABLE" value="test" mediafileid="8"/> </install4j>
The install4j task can contain vmParameter elements. These elements set VM parameters for the install4j command line compiler process.
The vmParameter element supports the following parameters:
Attribute | Description | Required |
---|---|---|
value | The value of the VM parameter. | Yes |
Example for setting an HTTP proxy (an internet connection is required for Windows code signing):
<install4j projectfile="myapp.install4j" winKeystorePassword="Kajjs7sgLg22"> <vmParameter value="-DproxySet=true"/> <vmParameter value="-DproxyHost=myproxy"/> <vmParameter value="-DproxyPort=1234"/> <vmParameter value="-DproxyAuth=true"/> <vmParameter value="-DproxyAuthUser=buildServer"/> <vmParameter value="-DproxyAuthPassword=iq4zexwb8et"/> </install4j>
In the samples/hello directory, execute
ant media
to start the build. If you have not defined install4jHomeDir in build.xml, the build will fail with a corresponding error message.