ant-ivy-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Nascif Abousalh-Neto <>
Subject RE: How To Get Module Dependency List
Date Mon, 22 Sep 2008 21:12:58 GMT

Have you looked into parsing the resolve report generated by Ivy? If you just need the module
names in the correct order I believe it contains all the information you need - actually more,
the task is really finding a way to filter out the extra information. You see, in the general
case a project will generate not really a simple list but more like a full graph with redundant
edges and sometimes even cycles, and you want to take that into account as to not overbuild.

Anyway, if you look into your top level directory for your cache, you will find the resolve

  c:/Documents and Settings/naabou/.ivy2/cache:
  total used in directory 521 available 3443519
  -rw-rw-rw-   1 naabou   root          3980 09-10 10:28 SAS-sas.core-caller-compile.xml

General format for those files is <ORG>-<MODULE>-<CONF>.xml

The file itself looks like this (some details omitted)

<?xml version="1.0" encoding="ISO-8859-1"?>
<?xml-stylesheet type="text/xsl" href="ivy-report.xsl"?>
<ivy-report version="1.0">
                <module organisation="SAS" name="sas.core" resolver="sas-repo">
                        <revision ...>
                                <caller organisation="SAS" name="sas.core-caller" conf="compile"
rev="latest.integration" callerrev="working"/>

So if you think of this as a graph, <module> defines your nodes and <caller> defines
your edges. By traversing this graph and removing redundant edges (to be precise, by visiting
the nodes of the minimum spanning tree of the depth-first traversal of the graph) you will
get your build list.


Nascif Abousalh-Neto
Software Development Manager
Query and Reporting  ▪ Business Intelligence Clients
Tel: + 1 919 531 0123 -

-----Original Message-----
From: Mark Melvin []
Sent: Monday, September 22, 2008 3:26 PM
Subject: Re: How To Get Module Dependency List

Hi Gilles,

I have played more with cachepath (I was playing with this as well as
cachefileset originally), and triggers and I simply cannot see how to
get an ordered list of dependencies, simply relying on the cache.  I
don't understand why this is so difficult for a dependency management
tool as powerful as Ivy.  Doesn't anyone else do this?  All I am
trying to do is figure out a build order for any given project.  But I
don't have the luxury of having all of the source code checked out in
ordered subfolders - I only have the source and the Ivy file for the
project I am resolving.  All I want to do is resolve a module, and
transitively get an ordered list of project names so I can trigger
builds on a CI server in the correct order.  So, as I said before - if
I have a project 'A', that declares in its Ivy file that it depends on
project 'B', and 'B' was published previously with an Ivy file that
says it depends on project 'C' - so my dependency graph looks like

 | A |
 | B |
 | C |

All I want to do is perform a resolve on project 'A', and somehow
construct a list containing ['C', 'B', 'A'].  Is this just too much to
ask, or am I still missing something??  I can get back a list of
published jars to feed to ivy:buildlist as a fileset reference - but I
have no idea how to map those to Ivy files in the cache because the
Ivy files are stored in the cache with version numbers encoded in
their filename and I cannot specify a pattern to ivy:buildlist's
ivyfilepath attribute.  It would work if I could specify and
ivyfilepath like:


I have verified this by specifying a hard-coded version in place of
[version] and then buildlist will work with the cache.

Do I need to extend Ivy or write some sort of Java accomplish what I
am trying to do?  Is there a way to work with file paths directly from
a local repository instead of the cache?  I only ever intend on using
a local repository anyway.  In fact - I don't even want to use a cache
if I don't have to.  Is it possible to run without a cache?  I
remember this being talked about in the 1.x days but I can't see any
reference to it in 2.0.


On Sat, Sep 20, 2008 at 7:00 AM, Gilles Scokart <> wrote:
> An ordered list in ant is a path.  Try thus to use cachepath [1]
> Now, to do what you finally want to achieve (trigger build of
> dependencies first), you might better play with a settings that use
> triggers [2].
> [1]
> [2]
> 2008/9/18 Mark Melvin <>:
>> Hi,
>> Someone please correct me if I am wrong - but I don't see any way to
>> simply get a reference to an ordered list of dependencies (using Ant).
>>  I see there is the ivy:buildlist task, but this assumes you have all
>> of your dependencies available in a directory somewhere.  I would like
>> to get this information just by doing a resolve.  I tried using this
>> task with the cache, like so:
>>    <ivy:cachefileset organisation="" module="myModule"
>> inline="true" setid="deps.fileset"/>
>>    <ivy:buildlist reference="build-path" skipbuildwithoutivy="true">
>>        <fileset refid="deps.fileset"/>
>>    </ivy:buildlist>
>> But this finds nothing because the path to the ivy.xml files is
>> non-standard in the cache.  Fine, I change it like so:
>>    <ivy:buildlist reference="build-path" skipbuildwithoutivy="true"
>> ivyfilepath="../ivys/ivy.xml">
>>        <fileset refid="deps.fileset"/>
>>    </ivy:buildlist>
>> But that isn't going to work either - because the ivy files are stored
>> in the cache with the version number encoded in the filename.  And it
>> looks like the 'ivyfilepath' attribute does not accept any sort of
>> patterns.  I can get it to work if I hard-code the versioned filename
>> in the cache into the 'ivyfilepath' attribute - but that obviously is
>> not a solution moving forward.
>> So - perhaps I should explain what I am trying to do.  I just want to
>> get an ordered list of module names according to the transitive
>> dependencies.  This should be doable as the information is all there
>> after a resolve.  So if A depends on B depends on C, I just want to
>> get back "A, B, C".  The reason I want this is if I want to build A, I
>> want to walk the dependencies and trigger remote project builds in the
>> correct order (C, then B, then A).
>> Short of actually parsing the ivy files directly in the cache - is
>> there any way to do this?  This seems like a relatively basic thing to
>> do - but I don't see an easy way to do it.  Hopefully I am just
>> missing something obvious.
>> Thanks,
>> Mark.
> --
> Gilles Scokart

View raw message