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 Timothy Aston <Ti...@ca.ibm.com> on 2009/11/24 14:25:09 UTC

Loading a dependency into 2 configurations?


I feel like this is a basic question.  I'm still quite new to Ivy and
haven't fully grasped all the concepts yet, so maybe there is a totally
different way of doing this.

My situation is that I've got some dependencies that I need for both
compiling and running.  Thus far, I've had one configuration for
compile-time dependencies, and a second one for run-time dependencies.
This makes it quite simple since I can just point at one folder for my
compile classpath, and the other folder for my runtime (a WAR file).  What
I was thinking is that I could just specify something like:

      conf="dev->default, install->default"

on my dependency, but that gives an error.

Is there a better way of achieving this?


-Tim

Re: Loading a dependency into 2 configurations?

Posted by Gareth Western <ga...@garethwestern.com>.
Oops, I meant our "compile-time" configuration extends the "run-time"
(i.e. war) configuration, as the war configuration is a subset of the
compile time one.

On Tue, Nov 24, 2009 at 2:42 PM, Gareth Western
<ga...@garethwestern.com> wrote:
> Hi Tim,
>
> We do something similar. Our "run-time" configuration extends the
> "compile-time" one. We use the "cachepath" ant task to create the
> classpath for the compile time dependencies, and then the
> "cachefileset" task to create a fileset of jars to copy into the WAR
> file.
>

Re: Loading a dependency into 2 configurations?

Posted by Gareth Western <ga...@garethwestern.com>.
Hi Tim,

We do something similar. Our "run-time" configuration extends the
"compile-time" one. We use the "cachepath" ant task to create the
classpath for the compile time dependencies, and then the
"cachefileset" task to create a fileset of jars to copy into the WAR
file.

so our ivy xml has something like this:
...
  <configurations>
    <conf name="compile" extends="war"/>
    <conf name="war" />
  </configurations>
  <dependencies>
    <dependency org="javax.servlet" name="servlet-api" rev="2.4"
conf="compile->default"/>
    <dependency org="ojdbc14" name="ojdbc14" rev="10.2.0.4"
conf="compile->default"/>
    <dependency org="stax" name="stax" rev="1.2.0" conf="war->default"/>
    <dependency org="jcommon" name="jcommon" rev="0.8.2" conf="war->default"/>
   ....

and the ant scripts use:
...
    <ivy:cachepath pathid="classpath" conf="compile" />
    <ivy:cachefileset setid="webimpact-lib" conf="war" />
...

But keeping the configurations completely separate is ok too. The only
reason you're getting the error (i think) is because you should use a
semicolon instead of a colon.

i.e. conf="dev->default;install->default"

And you can also specify multiple configurations on the left hand side
of the "->" to save time

i.e. conf="dev,install->default"


Regards,

Gareth

On Tue, Nov 24, 2009 at 1:25 PM, Timothy Aston <Ti...@ca.ibm.com> wrote:
>
>
> I feel like this is a basic question.  I'm still quite new to Ivy and
> haven't fully grasped all the concepts yet, so maybe there is a totally
> different way of doing this.
>
> My situation is that I've got some dependencies that I need for both
> compiling and running.  Thus far, I've had one configuration for
> compile-time dependencies, and a second one for run-time dependencies.
> This makes it quite simple since I can just point at one folder for my
> compile classpath, and the other folder for my runtime (a WAR file).  What
> I was thinking is that I could just specify something like:
>
>      conf="dev->default, install->default"
>
> on my dependency, but that gives an error.
>
> Is there a better way of achieving this?
>
>
> -Tim
>