ant-ivy-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Garima Bathla <garima.bat...@gmail.com>
Subject Re: registering an Ivy listener
Date Tue, 05 May 2009 05:40:05 GMT
Well there are triggers in Ivy but you can only invoke a trigger to a
predefined event. You can create your own triggers and then tell IVY about
the classpath, and typedef the trigger and then register it.

e.g.
https://svn.apache.org/repos/asf/ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/trigger/Trigger.java

MyTrigger implements Trigger {
...
}

In ivysettings.xml

<classpath file="path/to/you/custom/build/trigger.jar>
<typedef name="MyTrigger" classname="path.to.MyTrigger.in.trigger.jar">

<triggers>
<MyTrigger event="pre-defined-ivy-events"/>
</triggers>

I hope it will work, I haven't tried it out yet.

Regards,
Garima.


On Mon, May 4, 2009 at 10:29 PM, Mitch Gitman <mgitman@gmail.com> wrote:

> I'm interested in registering an *IvyListener *implementation to listen for
> an *IvyEvent *of some sort. Assume we're working within an Ant script.
>
> Now, I see that it's easy enough to register an *IvyListener **
> programmatically*. Just obtain an *EventManager *like so:
> IvyContext.getContext().getEventManager();
>
> And then on *EventManager*, I can call addIvyListener(...) to my heart's
> content.
>
> But then I have to ask myself, "Why do I have to do this programmatically?
> Why not just do it in the Ant script?" Here's an example from the Javadoc
> for one particular *IvyListener*, *AntBuildTrigger*, at
> doc/reports/api/org/apache/ivy/ant/AntBuildTrigger.html:
>  <ant-build-trigger event="pre-resolve-dependency"
>                    filter="revision=latest.integration"
>                    antfile="/path/to/[module]/build.xml"
>                    target="compile"/>
>
> So I'm figuring that there's a typedef preceding this to associate the
> element ant-build-trigger with the *AntBuildTrigger *class. But the above
> XML appears just to instantiate the trigger, not register it.
>
> So does some XML like the above suffice to actually register the listener
> and not just declare it? Or is there some extra XML needed to actually
> register the listener with Ivy?
>
> Thanks.
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message