A Gant script is a Groovy script that contains target definitions, calls to a pre-defined AntBuilder, and operations on some other predefined objects. The two main pre-defined objects are called includeTargets and includeTool. includeTargets is for including targets defined in other Gant scripts or appropriately constructed classes. includeTool is for including classes that provide services for use in a Gant file. The following script shows some examples:
In this case we include targets from a pre-compiled class called Clean. This defined an object cleanPattern that we can add new patterns to. As well as classes we can use files:
It is also possible to use string literals for the situation where target definitions will be constructed programmatically.
As an example, if we have a directory with a source code sub-directory containing Java and Groovy source that needs compiling then we might have the Gant script:
Now from the command line we can issue the command "gant compile" or "gant clean".
If we want a default target then we specify what it is: