ant-ivy-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Gareth Western <>
Subject Multi-module dependency configuration
Date Fri, 10 Jul 2009 13:54:48 GMT

I'm having trouble configuring a multi-module project. It's a
straightforward scenario, but I can't seem to get the syntax quite
right. Here's the situation:

Module A is a webapp, producing a .war artifact, and has a dependency
on module B, which produces a jar. Both modules have a dependency on a
third-party jar, which is provided by the servlet container at runtime
and I therefore do not want included in the module A war file.

The module B (the jar module) configuration looks like this:

<ivy-module version="2.0">
  <info organisation="com.garethwestern" module="B"/>
    <conf name="compile" extends="jar" />
    <conf name="jar" />
    <artifact type="jar" conf="jar" />
    <dependency org="j2ee" name="j2ee" rev="1.3.1"
conf="compile->default" /> <!-- this is the "provided" jar -->
    <dependency org="commons-beanutils" name="commons-beanutils"
rev="1.7.0" conf="jar->default" />

The module A configuration looks like this:

<ivy-module version="2.0">
  <info organisation="com.garethwestern" module="A" />
    <conf name="compile" extends="war"/>
    <conf name="war" />
    <artifact name="myModule" type="war" conf="war"/>
    <dependency org="j2ee" name="j2ee" rev="1.3.1"
conf="compile->default"/> <!-- provided jar again -->
    <dependency org="com.garethwestern" name="B" rev="SNAPSHOT"
changing="true" conf="compile->jar" />

In the Ant script for module A I use the cachepath task to create the
classpath for compiling the module:
    <ivy:cachepath pathid="classpath" conf="compile" />

Then, when I construct the war file, I use the cachefileset task to
create a fileset for all files to be copied to WEB-INF/lib inside the
    <ivy:cachefileset setid="webinf-lib" conf="war" />

The problem is that the com.garethwestern.B dependency is specified
with the "compile->jar configuration" meaning that it will not be
included in the webinf-lib fileset (which uses the "war" configuration
to avoid including the j2ee.jar). If i change the B dependency to
conf="war->jar" then compilation fails because the classpath is
configured using the "compile" configuration. I thought that maybe a
conf such as *->jar might work, but that seems to just have the same
affect as war->jar...

I'm sure that what I'm trying to achieve is incredibly simple, but
after reading through the Ivy documentation and looking through
various examples online my head's in a muddle at the moment, and so
I've resorted to the mailing list. Can anyone out there help me?



View raw message