ant-ivy-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Matt Benson <gudnabr...@gmail.com>
Subject Re: Simple Ivy/WTP Example
Date Wed, 17 Mar 2010 14:37:11 GMT

On Mar 15, 2010, at 2:30 PM, Steve Taranto wrote:

> Can someone offer a simple example of how to get Ivy to publish  
> dependencies
> to /WEB-INF/lib?  I've followed the very simple example in the FAQ  
> and it
> doesn't work.
>
> Here's what I'm doing....
>
> (1) I create a WTP Web project.
>
> (2) My {project_root}/ivy.xml contains...
>
> <dependencies>
>   <dependency org="commons-lang" name="commons-lang" rev="2.0" />
> </dependencies>
>
> (3) I go to Java Build Path / Libraries / Add Library... and add
> "ivy.xml[*]".  The Publish/export dependency is "/WEB-INF/lib".
>
> (4) I go to Java EE Module Dependencies and, as expected, "ivy.xml 
> [*]".
>
> Here's where I fall down...  At this point I expect to see the  
> jar's in my
> /WebContent/WEB-INF/lib/ directory.  I don't - it's empty.
>
> So, I then run a <ivy:retrieve /> task and the three commons-lang  
> jar's show
> up in the {project_root}/lib directory - not /WebContent/WEB-INF/lib.
>
> Of course, when I export to .war they jar's aren't there since they  
> are in
> the wrong directory.
>
> What am I missing?
>

You're missing the fact that you can have the libraries in your  
classpath, and deployed with your project, without them showing up in  
WEB-INF/lib.  Also, I typically find that to have all my dependencies  
expressed in Ivy and thus have a completely externalized build, I  
have to compartmentalize my dependencies such that I compile against  
one set, but only deploy the other set with my app.  In practice,  
this means I have a default conf which I intend to deploy, plus a  
compile-only conf that I include in a separate Ivy library.  My  
ivy.xml further defines a compile conf that extends default and  
compile-only, and it is this conf against which my external build  
compiles.

HTH,
Matt

> BTW,  this is plain old Eclipse 3.5 w/IvyDE 2.1.0 final.


Mime
View raw message