You are viewing a plain text version of this content. The canonical link for it is here.
Posted to ivy-user@ant.apache.org by Simon <si...@gmail.com> on 2007/03/26 07:56:17 UTC

how to make fileset of resolved dependencies

Hello all,

What is the best way to resolve the specific dependencies of a
particular artifact into a path or fileset for use in Ant?

For example, I have a war file (just one of the possible outputs from
my project) which depends on A.jar, and A.jar depends on B.jar and
C.jar.   When I build my war file, I need to include those
dependencies - it would be great if this could be completely computed
from the ivy resolve process so that if the dependencies of A.jar
change I won't need to change anything in the build for this project.

I see there are two tasks that come close ( cachefileset and cachepath
) but they don't seem to match perfectly and also the docs recommend
it's better not to use them .... so just wondering how everyone else
is doing this?

Thanks for any advice!

Cheers,

Simon.

Re: how to make fileset of resolved dependencies

Posted by Xavier Hanin <xa...@gmail.com>.
On 3/26/07, Simon <si...@gmail.com> wrote:
>
> Hello all,
>
> What is the best way to resolve the specific dependencies of a
> particular artifact into a path or fileset for use in Ant?
>
> For example, I have a war file (just one of the possible outputs from
> my project) which depends on A.jar, and A.jar depends on B.jar and
> C.jar.   When I build my war file, I need to include those
> dependencies - it would be great if this could be completely computed
> from the ivy resolve process so that if the dependencies of A.jar
> change I won't need to change anything in the build for this project.
>
> I see there are two tasks that come close ( cachefileset and cachepath
> ) but they don't seem to match perfectly and also the docs recommend
> it's better not to use them .... so just wondering how everyone else
> is doing this?


The doc recommend the use of the retrieve task which makes your build more
independent from Ivy: once you have called retrieve, your build looks
exactly the same as any other Ant build. But we should update this doc
because it's not a strong recommendation, we should only indicate that if
you want to have a build not too dependent on Ivy, you should prefer
retrieve.

Anyway, in your case you can use either cachepath, cachefileset or retrieve.
The difference between cachefileset and cachepath is slight, it's only the
data types created by those tasks: the first create a fileset, the second a
path. Depending on your needs, you might prefer one or the other. The
retrieve task is different, it copies the artifacts in the location you want
(for example a lib directory), then you can use regular ant datatypes like
path or fileset to do what you want with those artifacts.

In your case, if you use the Ant war task to package your war, this task
takes a fileset for its lib. So you can either use the ivy:cachefileset task
to create this fileset, or the retrieve task to copy all required artifacts
in a lib directory that you can then include in your war using the regular
fileset facility of Ant.

HTH,

- Xavier

Thanks for any advice!
>
> Cheers,
>
> Simon.
>

Re: how to make fileset of resolved dependencies

Posted by Simon <si...@gmail.com>.
Thanks to both of you for the responses.

> I personnaly use retrieve task fro bring back all dependencies in my project
> , but i define specifics configurations for each kind of artifact my project
> will generate

Greg - yes, I think this is the solution that I was missing at first.
I was confused because the examples I've seen used the configurations
for other purposes (specifying source vs runtime builds etc) rather
than tailoring for specific artifacts - but I see it works just as
well like that.

I think I don't really mind having my build dependent on ivy - the way
I see it, once I have taken the hit of making the user install it I
want to use all the power I can get from it.   I'm mainly concerned to
make the build as clear and simple as possible and it seems like
arranging the build tree with multiple lib directories to suit ivy
might have people scratching their heads just as much or more than a
simple ivy task that defines the fileset for the dependency.  I also
have some large-ish dependencies, so I don't really want multiple
copies of them unnecessarily.

Thanks again!

Cheers,

Simon.

Re: how to make fileset of resolved dependencies

Posted by Gregoire Henry <gh...@gmail.com>.
Hello

Just a little answer to your question ...
I personnaly use retrieve task fro bring back all dependencies in my project
, but i define specifics configurations for each kind of artifact my project
will generate
for example, in one of my project , i have a "client" configuration and an
"application" configuration each of them will be "retrieve" in a specific
subdir of "lib" directory ...

All i need to do after that is to create some filelist or path with ant .

In this case if a dependency have to be modified , i just have to modify the
ivy file, but the build file remains inchanged...

HTH

Greg

PS : BTW this case could leave to have multiple occurences of the same jar
in several lib subdir, but i don't find other solution to have my build the
less dependent from ivy ...



2007/3/26, Simon <si...@gmail.com>:
>
> Hello all,
>
> What is the best way to resolve the specific dependencies of a
> particular artifact into a path or fileset for use in Ant?
>
> For example, I have a war file (just one of the possible outputs from
> my project) which depends on A.jar, and A.jar depends on B.jar and
> C.jar.   When I build my war file, I need to include those
> dependencies - it would be great if this could be completely computed
> from the ivy resolve process so that if the dependencies of A.jar
> change I won't need to change anything in the build for this project.
>
> I see there are two tasks that come close ( cachefileset and cachepath
> ) but they don't seem to match perfectly and also the docs recommend
> it's better not to use them .... so just wondering how everyone else
> is doing this?
>
> Thanks for any advice!
>
> Cheers,
>
> Simon.
>