ant-ivy-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Geoff Clitheroe <g.clithe...@gmail.com>
Subject Re: ivy:install and dependency attribute differences Click to flag this post
Date Fri, 15 May 2009 02:07:13 GMT
Hi Tom,

I finally got back to this.  Works great, thanks a lot.

Cheers,
Geoff

Geoff Clitheroe wrote:

> Hi,
>
> I'm using Ivy 2.0.0-beta1.  I'm have an ivy.xml file that describes
> dependencies to build a project and I'm working on creating a build file
> to copy those dependencies to an enterprise repo using the ivy:install
> task.  Basically I expect to;
>
> 1. get a project with an ivy.xml file.
> 2. bless the dependencies outlined in the ivy.xml file.
> 3. copy the dependencies to the enterprise repo.
> 4. build and test the project from the enterprise repo.
>
> Is there someway to run the install task directly from the ivy.xml file or
> another way to streamline the process?  At the moment I'm cutting and
> pasting and the attributes are different in each tag so it is not very
> efficient?  e.g., to describe a module;
>
> dependency has attributes: org, name, rev
> ivy:install has attributes: organistation, module, revision
>
> <dependency org="commons-dbcp" name="commons-dbcp" rev="1.2.1">
>            <exclude org="javax.sql" name="jdbc-stdext"/>
>        </dependency>
>
> <ivy:install settingsRef="geonet.enterprise.settings" overwrite="true"
> transitive="true" haltonfailure="false"
>            organisation="commons-dbcp" module="commons-dbcp"
> revision="1.2.1"
>            from="${from.resolver}" to="${to.resolver}"/>
... [show rest of quote]

You could use an ant macrodef. e.g.

<macrodef name="dependency" description="Macro to install an ivy dep in
the same format as in an ivy file">
        <attribute name="org"/>
        <attribute name="name"/>
        <attribute name="rev"/>
        <attribute name="conf"/>
        <sequential>
             <ivy:install settingsRef="geonet.enterprise.settings"
                overwrite="true" transitive="true" haltonfailure="false"
                organisation="@{org}" module="@{name}"
                revision="@{rev}"
                from="${from.resolver}" to="${to.resolver}"/>
         </sequential>
</macrodef>

Now you can just copy and paste the dependencies section into an ant
task unaltered (well, you'll have to strip out exclude bits, etc.).

Alternatively, you could probably do something with an ivy
post-resolve-dependency trigger
(http://ant.apache.org/ivy/history/2.1.0-rc1/settings/triggers.html)
calling an ant target that calls ivy:install.

Tom

Mime
View raw message