Generated ANT build script usage
1. ANT Targets
2. Standard Targets
3. Built-In Special Targets
4. Customizing Properties
Invicta generates a standard build.xml file on which ANT can run (see ANT documentation for more information). The file is built in a way such that the first step performed is the invocation of Invicta, which checks whether its running again is necessary in order to recreate the build.xml (because of configuration changes, for example).
To see a list of available targets, use ant -projecthelp. The targets appear as 'methods' of component 'classes'. For example, a JAR component named mycomp in the project myproj would have the target myproj.mycomp1.compile.
Of course, in case a component was defined as dependent of another component, the ANT targets are defined with the required dependency, meaning the required component will be compiled first. In addition, there can also be a dependency between two targets of the same component; for example: pack depends on compile, meaning in order for packing to run, compilation must first be completed.
Every component has a few targets by default. The following list describes the actions that are performed for each target. Note: the names are a standard; it's not obligatory to perform the actions listed in the corresponding target.
init - definition of properties and classpath, checking of various conditions.
prepare - creation of output directories, preparations for the main action.
compile - compilation of sources.
compile.nodep - same as compile, without regard to dependency (in case you are sure that classes on which you depend are udpated).
pack - packing of compiled classes (in a JAR, for example).
pack.nodep - the same as pack, without regard to dependency.
dist - distribution, copy the resulting files to a structure in which they will be distributed (for example, all the JARs into directory)
dist.nodep - same as dist, without regard to dependency.
clean - cleanup of whatever the build process has created (preapre's directories, for example)
For example, running the following command will compile files associated with component mycomp1 of the myproj project.
ant myproj.mycomp1.compile
3. Built-In Special Targets
The generated build.xml contains a few targets that are for the project-scope.
<project_name>.dist.all - activate the dist target of all components in order to distribute the whole project.
<project_name>.build.all - activate the build target of all components in order to build the whole project.
<project_name>.clean.all - activate the clean target of all components.
All settings, such as compilation flags, names, deployment settings and more, are stored as ANT properties that can be customized in ANT run-time. Customization can be done in one of two ways:
Using the standard -D<propertyName>=<propertyValue> syntax of ANT.
For example, to change the value of property prop1 to val1 while invoking target tar1, run
ant tar1 -Dprop1=val1.Editing the custom.properties file. This is a standard properties file of ANT, which contains multiple property definitions. Using this file instead of '-D' is better when you want to customize multiple properties. Each line has the syntax <propertyName>=<propertyValue>.
For example, to change the value of property prop1 to val1 while invoking target tar1, add the line:
prop1=val1
You may override the default file name using the property general.properties.custom.Properties' names are a combination of a prefix and the name of the property or the type. The prefix can be general, project or a component's full name.
There are two levels of customization: Project/General affects all components, whereas component-specific affects only one component. Some example:
-Dgeneral.compile.debug=false - disables the debug compilation mode of all the components.
-Dmyproj.comp1.compile.debug=true - enables the debug compilation mode of comp1 only.
Using custom.properties:
# Set the URL of an application server to used by the whole project:
project.deploy.server.url=http://server:8671# Set the vendor name of the products of all components:
project.vendor.name=TAU# Set the vendor name of the products of comp1 only.
myproj.comp1.vendor.name=Amit