triggers
            Tag: triggers
since 1.4
Defines a list of triggers to activate on some Ivy events.
A trigger is an action which is performed whenever a particular event occurs.
Ivy supports 3 type of triggers out of the box: 
- ant-callcalls a target in the same build as the original one whenever a particular event occurs.
- ant-buildcalls an ant build which may be in another ant build script.
- logecho a message, usually in a file
If you want to use a different trigger, you can 
implement your own.
The event available in Ivy are the following ones:
    | Name | Attributes | Description | 
|---|
    | pre-resolve | 
            organisationthe organisation of the module for which the dependencies will be resolved
 modulethe name of the module for which the dependencies will be resolved
 revisionthe revision of the module for which the dependencies will be resolved
 confcomma separated list of configurations which will be resolved
 | Fired at the beginning of the resolve process, before a module dependencies and transitive dependencies are resolved. | 
    | pre-resolve-dependency | 
            organisationthe organisation of the dependency resolved
 modulethe name of the dependency resolved
 req-revisionthe requested revision for the dependency since 2.0 (provided for consistency with post-resolve-dependency)
 req-revision-defaultthe default requested revision constraint for the dependency since 2.0req-revision-dynamicthe requested revision dynamic constraint for the dependency since 2.0revisionthe requested revision for the dependency
 resolverthe name of the resolver used to resolve the dependency
 | Fired before each dependency is resolved. In this case resolved means resolving the actual revision if the requested revision is a version constraint and not a static version, and downloading all necessary metadata information. | 
    | post-resolve-dependency | 
            organisationthe organisation of the dependency resolved
 modulethe name of the dependency resolved
 req-revisionthe requested revision for the dependency since 2.0req-revision-defaultthe default requested revision constraint for the dependency since 2.0req-revision-dynamicthe requested revision dynamic constraint for the dependency since 2.0revisionthe revision of the dependency resolved, or the requested revision if the resolution was not successful
 resolvedtrue if the resolution was successful, false otherwise
 durationthe time elapsed to resolve the dependency (in ms) since 2.0resolverthe name of the resolver used to resolve the dependency
 any extra attributeall extra attributes found on the info tag of the resolved dependency are available since 2.0 | Fired after each dependency is resolved | 
    | post-resolve | 
            organisationthe organisation of the module for which the dependencies have been resolved
 modulethe name of the module for which the dependencies have been resolved
 revisionthe revision of the module for which the dependencies have been resolved
 confcomma separated list of configurations resolved
 resolve-idthe identifier of the resolution process since 2.0nb-dependenciestotal number of dependencies, including transitive and evicted ones since 2.0nb-artifactstotal number of artifacts resolved, excluding metadata artifacts since 2.0resolve-durationthe time (in ms) elapsed to resolve dependencies, before dowloading artifacts since 2.0download-durationthe time (in ms) elapsed to download all artifacts, excluding metadata artifacts downloaded during the first phase of the resolution process since 2.0download-sizethe total size (in bytes) of all downloaded artifacts, excluding metadata artifacts. Only artifacts actually downloaded (not in cache or used from their original location) are considered since 2.0 | Fired at the end of the resolve process, when all module dependencies have been resolved | 
    | pre-download-artifact | 
            organisationthe organisation of the artifact which is about to be downloaded
 modulethe name of the module of the artifact which is about to be downloaded
 revisionthe revision of the the artifact which is about to be downloaded
 artifactthe name of the the artifact which is about to be downloaded
 typethe type of the the artifact which is about to be downloaded
 extthe extension of the the artifact which is about to be downloaded
 metadatatrue if the artifact to be downloaded is a metadata artifact, false for published artifacts since 2.0resolverthe name of the resolver used to download the artifact
 originthe origin location from which it will be downloaded
 localtrue if it's a local artifact, false otherwise
 | Fired before an artifact is downloaded from a repository to the cache | 
    | post-download-artifact | 
            organisationthe organisation of the artifact which was just downloaded
 modulethe name of the module of the artifact which was just downloaded
 revisionthe revision of the the artifact which was just downloaded
 artifactthe name of the the artifact which was just downloaded
 typethe type of the the artifact which was just downloaded
 extthe extension of the the artifact which was just downloaded
 metadatatrue if the downloaded artifact is a metadata artifact, false for published artifacts since 2.0resolverthe name of the resolver used to download the artifact
 originthe origin location from which it was downloaded
 localtrue if it's a local artifact, false otherwise
 sizethe size in bytes of the downloaded artifact
 durationthe time elapsed to download the artifact (in ms) since 2.0filethe file to which it has been downloaded
 | Fired after an artifact has been downloaded from a repository to the cache | 
    | pre-retrieve since 2.0
 | 
            organisationthe organisation of the module for which the dependencies will be retrieved
 modulethe name of the module for which the dependencies will be retrieved
 revisionthe revision of the module for which the dependencies will be retrieved
 confcomma separated list of configurations which will be retrieved
 symlinktrue if Ivy will use symbolic links instead of copies on supported platforms, false otherwise
 synctrue if the retrieve process will be performed in sync mode, false otherwise
 | Fired at the beginning of the retrieve process. | 
    | post-retrieve since 2.0
 | 
            organisationthe organisation of the module for which the dependencies have been retrieved
 modulethe name of the module for which the dependencies will be retrieved
 revisionthe revision of the module for which the dependencies have been retrieved
 confcomma separated list of configurations which have been retrieved
 symlinktrue if Ivy used symbolic links instead of copies on supported platforms, false otherwise
 synctrue if the retrieve process has been performed in sync mode, false otherwise
 durationthe time elapsed in ms during the retrieve process
 sizethe total size of artifacts which have actually been copied (or symlinked)
 nbCopiedthe number of artifacts copied or symlinked
 nbUptodatethe number of artifacts which were already present and up to date at the destination location
 | Fired at the end of the retrieve process. | 
    | pre-retrieve-artifact since 2.1
 | 
            organisationthe organisation of the artifact which is about to be retrieved
 modulethe name of the module of the artifact which is about to be retrieved
 revisionthe revision of the the artifact which is about to be retrieved
 artifactthe name of the the artifact which is about to be retrieved
 typethe type of the the artifact which is about to be retrieved
 extthe extension of the the artifact which is about to be retrieved
 metadatatrue if the retrieved artifact is a metadata artifact, false for published artifacts
 sizethe size in bytes of the retrieved artifact
 fromthe absolute path from which it will be retrieved (usually a location in cache)
 tothe absolute path to which it will be retrieved
 | Fired before an artifact is retrieved from cache to a local location | 
    | post-retrieve-artifact since 2.1
 | 
            organisationthe organisation of the artifact which has just been retrieved
 modulethe name of the module of the artifact which has just been retrieved
 revisionthe revision of the the artifact which has just been retrieved
 artifactthe name of the the artifact which has just been retrieved
 typethe type of the the artifact which has just been retrieved
 extthe extension of the the artifact which has just been retrieved
 metadatatrue if the retrieved artifact is a metadata artifact, false for published artifacts
 sizethe size in bytes of the retrieved artifact
 fromthe absolute path from which it has just been retrieved (usually a location in cache)
 tothe absolute path to which it has just been retrieved
 | Fired after an artifact is retrieved from cache to a local location | 
    | pre-publish-artifact since 2.0
 | 
            organisationthe organisation of the artifact which is about to be published
 modulethe name of the module of the artifact which is about to be published
 revisionthe revision of the the artifact which is about to be published
 artifactthe name of the the artifact which is about to be published
 typethe type of the the artifact which is about to be published
 extthe extension of the the artifact which is about to be published
 resolverthe name of the resolver into which the artifact is about to be published
 filethe absolute path of the source file for the artifact
 overwrite"true" if the new data will overwrite existing artifacts, "false" otherwise
 | Fired before an artifact is published into a repository | 
    | post-publish-artifact since 2.0
 | 
            organisationthe organisation of the artifact that was published
 modulethe name of the module of the artifact that was published
 revisionthe revision of the the artifact that was published
 artifactthe name of the the artifact that was published
 typethe type of the the artifact that was published
 extthe extension of the the artifact that was published
 resolverthe name of the resolver into which the artifact was published
 filethe absolute path of the source file for the artifact
 overwrite"true" if the new data overwrote existing artifacts, "false" otherwise
 status"successful" if the artifact published successfully; "failed" if the artifact failed to publish, or if the status is unknown
 | Fired after an artifact is published into a repository.  Note that this event is fired whether or not the publication succeeded.  The "status" property can be checked to
 verify success.
 | 
The child tag used for the dependency resolver must be equal to a name of a trigger type (either built-in or added with the typedef tag).
Child elements
    | Element | Description | Cardinality | 
|---|
    | any trigger | adds a trigger to the list of registered triggers | 1..n | 
Built-in Triggers
Ivy comes with 3 built-in triggers: 
    | Name | Description | 
|---|
| ant-build | Triggers an ant build. Note that by default the ant build is triggered only once per build file, the property onlyonce can be set to false to change this. | 
| ant-call | Calls a target in the current ant build. | 
| log | Logs a message on the console or in a log file. | 
All triggers share some common attributes detailed here.
Among these attributes, you will find how to select when the trigger should be performed. You have to provide an event name, which is simple, but you can also use a filter expression. The syntax for this expression is very simple and limited: 
you can use the = operator to compare an attribute (left operande) with a value (right operande).
you can use AND OR NOT as boolean operators
you cannot use parenthesis to change the precedence
    | Attribute | Description | Required | 
|---|
    | name | the name of the trigger for identification purpose only | Yes | 
    | event | the name of the event on which the trigger should be performed | Yes | 
    | filter | a filter expression used to restrict when the trigger should be performed | No, defaults to no filter | 
Examples
<triggers>
    <ant-build antfile="${ivy.settings.dir}/[module]/build.xml" target="publish"
           event="pre-resolve-dependency" filter="revision=latest.integration"/>
</triggers>
Triggers an ant build of the ant file ${ivy.settings.dir}/[module]/build.xml (where [module] is replaced by the name of the dependency resolved) with the target "publish", just before resolving a dependency with a latest.integration revision.
Note that by default the ant build is triggered only once per build file. See below to see how to trigger the build more than once.
<triggers>
    <ant-build antfile="${ivy.settings.dir}/[module]/build.xml" target="publish"
           event="pre-resolve-dependency" filter="revision=latest.integration"
           onlyonce="false" />
</triggers>
Same as before, but this time the builds will be triggered as many time as the dependency is resolved, instead of only once.
<triggers>
    <ant-call target="unzip" prefix="dep"
          event="post-download-artifact" filter="type=zip AND status=successful"/>
</triggers>
Triggers an ant call of the target unzip just after downloading a zip artifact, prefixing all parameters to the target with 'dep'.
Here is how the target can look like:
<target name="unzip">
     <echo>
        unzipping artifact: 
        organisation=${dep.organisation} 
        module=${dep.module} 
        revision=${dep.revision}
        artifact=${dep.artifact}
        type=${dep.type}
        ext=${dep.ext}
        origin=${dep.origin}
        local=${dep.local}
        size=${dep.size}
        file=${dep.file}
     </echo>
     <mkdir dir="${basedir}/out"/>
     <unzip src="${dep.file}" dest="${basedir}/out"/>
</target>
<triggers>
    <log file="ivy.log" 
          message='downloaded "${origin}" to "${file}" (${duration}ms - ${size}B)'
          event="post-download-artifact" filter="status=successful"/>
</triggers>
Logs any successful artifact download, with information on the source and destination, and details on download size and duration.
The file attribute is optional, the log trigger will output messages to console if it isn't provided.