ant-ivy-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Mitch Gitman" <>
Subject Re: Clean way to differ between runtime and compile time dependencies? (So I do not include runtime deps in my war)
Date Sun, 11 Jan 2009 22:33:01 GMT
I haven't bothered to test this, so I may have gotten a detail wrong, but
here are some small additions to your ivy.xml file to filter out the servlet
<ivy-module version="2.0">
  <info organisation="domain.organisation" module="webproject" />

    <conf name="runtime" description="everything except the servlet API" />
    <conf name="compile" extends="runtime" description="Plus the servlet
API" />

    <artifact name="yourapp" type="war" conf="runtime" />
    <artifact name="yourapp" type="ear" conf="runtime" />

    <dependency org="org.apache.wicket" name="wicket" rev="1.3.5"
      <exclude org="org.apache.portals.bridges"
module="portals-bridges-common" />
      <exclude org="javax.portlet" module="portlet-api" />
    <dependency org="org.slf4j" name="slf4j-log4j12" rev="1.5.6"
conf="runtime->*" />
    <dependency org="javax.servlet" name="servlet-api" rev="2.3"
conf="compile->*" />

You'll notice that I introduced a couple configurations. One is runtime. The
other is compile, which extends runtime. Then for each dependency, I apply a
configuration. Each configuration is picking up all configurations provided
by the dependency module; that's the ->*.

I notice you don't have a publications section, so I added the makings of
one. Also, that filtering out of Wicket dependencies is something I would
put in the original ivy.xml for org.apache.wicket/wicket/1.3.5, rather than
directly in here. You can control that by specifying a configuration in that
file and then making the dependency conf here extend that configuration.

Hope that makes sense.

On Sun, Jan 11, 2009 at 2:02 PM, Kent Larsson <>wrote:

> Hi. I'm new to Ivy and desperately need some help. :-)
> I have this Ivy.xml:
> <ivy-module version="2.0">
>    <info organisation="domain.organisation" module="webproject"/>
>    <dependencies>
>        <dependency org="org.apache.wicket" name="wicket" rev="1.3.5">
>            <exclude org="org.apache.portals.bridges"
> module="portals-bridges-common"/>
>            <exclude org="javax.portlet" module="portlet-api"/>
>        </dependency>
>        <dependency org="org.slf4j" name="slf4j-log4j12" rev="1.5.6"/>
>        <dependency org="javax.servlet" name="servlet-api" rev="2.3"/>
>    </dependencies>
> </ivy-module>
> This gives me the following JAR files in lib/
> log4j-1.2.14.jar     slf4j-api-1.5.6.jar      wicket-1.3.5.jar
> servlet-api-2.3.jar  slf4j-log4j12-1.5.6.jar
> I want to include all of these JAR files EXCEPT one in the .war file.
> The file I do not want to include is servlet-api-2.3.jar as it's only
> a compile time dependency. It will be provided by Tomcat in my case.
> How would you cleanly separate these? After <ivy:retrieve sync="true"
> /> I have all the dependencies in lib/ .
> What is the nicest way to exclude this one JAR-file? Should I just
> hard code it in my Ant script? Has Ivy some nice feature for this? I'm
> new to Ivy, I have looked around but haven't found any example I can
> apply.
> Best regards, Kent

  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message