install4j
task
that is provided in $INSTALL4J_HOME/bin/ant.jar
and set the projectfile
parameter to the install4j project
file that you want to build.
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>
On macOS, the ant.jar
file is inside the application bundle, for the default application directory the full path is
/Applications/install4j.app/Contents/Resources/app/bin/ant.jar
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.
install4j
task supports the following parameters:
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 .
| |
license |
Corresponds to the --license command line option.
If the license has not been configured yet, you can set the license key with this attribute.
| Yes |
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 |
preserve |
Corresponds to the --preserve
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 |
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 variablefile
elements.
These elements read text files containing compiler variables definitions. They correspond to the
--var-file
command line option
The variablefile
element supports the following parameters:
Attribute | Description | Required |
---|---|---|
file | The path of the variable file. | Yes |
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.