ant-ivy-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jarosław Wypychowski <>
Subject "ant call trigger can only be used from an ant build" from ant build
Date Wed, 09 May 2007 21:47:34 GMT
Hi All,

I'm struggling with ivy 2.0.0-alpha-1 and ant (1.6.5/1.7.0) over Java
1.5.0_10/_11 and have run out of ideas for now. Hope someone might help
with this.

The scenario:

I wanted to make a simple build system with ant/ivy. For that i used
triggers on pre-resolve-dependency (ant-call). A trigger checks if given
module is available (ivy:findrevision) and if not it calls a build on
appropriate project (I know it is not a perfect solution - just
started). Of course those sub-projects are also ivy-configured and use
the same mechanism. 

I have tried running this scenario with the same project state (clearly
checked out of SVN) and the results were something like that:
machine | ant version | ant options | result - first run | second run
A       | 1.6.5       |             | FAILURE            | SUCCESS
A       | 1.6.5       | -verbose    | FAILURE            | SUCCESS
A       | 1.6.5       | -debug      | SUCCESS            |
B       | 1.6.5       |             | FAILURE            | SUCCESS
B       | 1.7.0       |             | FAILURE (50%)      | SUCCESS
B       | 1.6.5       | -verbose    | SUCCESS            |
B       | 1.6.5       | -debug      | SUCCESS            |

All failures are caused by ivy:resolve failing to find matching
dependencies in internal projects. I have tried to debug this with ivy
source - but then the scenario always succeeds. 
I've found following information in the ant logs for the failed

[ivy:resolve] ant call trigger can only be used from an ant build.

And this is strange. 
From the source of ivy the ant project context is taken from ivy
context. IvyContext is taken from ThreadLocal variable initialized on
the first call to it or on demand. 

From the situation I guess that IvyContext is not initialized while the
trigger should be called. This might mean that one of the sub calls are
threaded by ant (antcall/ant/macro ?) for some reason and IvyContext for
that thread has of course no context set - and therefore no ant project
is available for ivy:resolve.
But this is only a loose guess.

Any ideas on how to solve this ?  For the while I have a "workaround"
based on a handcrafted version of ivy compiled by hand that behaves
correctly in all situations (I don't know why).

And more general - maybe a ThreadLocal is not a good place for keeping
IvyContext in ant environment ? Any thread created by ant is out of the
scope of IvyContext at once (or am I wrong ?).

Best Regards.


Jaroslaw Wypychowski
Interdyscyplinarne Centrum Modelowania Matematycznego i Komputerowego UW

View raw message