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 Steve Taranto <st...@gmail.com> on 2010/03/15 20:30:00 UTC

Simple Ivy/WTP Example

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?

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

Re: Simple Ivy/WTP Example

Posted by Alex Foreman <Al...@morganstanley.com>.
In your project setup (Preferences /IvyDE), there should be a retrieve tab.

By default it is set to lib/.

Try changing this to WEB-INF/lib

HTH

On 15 March 2010 19:30, Steve Taranto <st...@gmail.com> 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?
>
> BTW,  this is plain old Eclipse 3.5 w/IvyDE 2.1.0 final.
>



-- 
Alex Foreman

Re: Simple Ivy/WTP Example

Posted by Matt Benson <gu...@gmail.com>.
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.