ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Xavier Hanin" <>
Subject Re: Dynamically building dependencies...
Date Fri, 12 Jan 2007 18:46:49 GMT
On 1/12/07, Andrew Close <> wrote:
> hello all,

Hello Andrew,

i'm looking for a more elegant/efficient solution to a problem we have
> in our build scripts.
> our source code is fairly unorganized as an organization, and as we've
> grown and added systems it has become unwieldy. this is more of a
> process problem than an ANT script problem, but i'm hoping i can come
> up with a short term solution before we can get around to
> re-architecting our entire system.
> our source code is broken up by JAR files.  obviously, some of these
> JAR files rely on other JAR files to work properly.  i've managed to
> cobble together a full build that currently builds all of our
> deliverables in build-dependency order, but i would like to be able to
> build components (and their dependencies) individually.
> for example:
> JAR A depends on JAR B and JAR C
> when building JAR A, if JAR B and JAR C do not exist, build them
> first, then continue with A

You may be interested in looking at Ivy (
It's a dependency manager integrated with ant, with some setup you can ask
Ivy to order a list of projects according to the dependencies to build them
all, you can trigger dependency builds when resolving dependencies of a
module, and so on. And you will get dependencies reports as a bonus.


i know this can lead to a monstrous build chain where dependencies are
> building dependencies... ad infinitum.  but i am hoping this is a
> short term solution. :)
> at the moment i have a target in the build.xml for deliverable A that
> is called 'dependencies'.  this target looks to see if the JAR files
> for B and C exist, if not, use the ant task to build B and\or C, then
> continue building A.  this works but is a pain to maintain as
> dependencies change and new deliverables are added or removed.  it
> also requires updating the actual scripts regularly.  an example is
> pasted at the bottom.
> is there a better solution for this?  is there an easy way to just
> read in a file containing the JAR dependencies and iterating through
> that to check/build so we would only have to update a list or
> properties file?
> any thoughts or suggestions would be greatly appreciated.
> thanks!
> andy
> example:
> in this instance we're building the a deliverable/JAR that depends on
> only one other JAR, core.  the 'build' target is executed but depends
> on 'core.dependency'.  'core.dependency' depends on
> 'check.dependencies' which just determines if the required JAR files
> are located in the central lib/ dir.  if they exist, all is good and
> the initial deliverable is built.  if they don't exist a flag,
> 'build.core', is set so we know that core needs to be built first.  an
> ANT task is executed in 'core.dependency' telling core to build
> itself.
>         <target name="check.dependencies" depends="init" unless="BUB">
>                 <condition property="build.core">
>                         <available file="${lib.dir}/core.jar"/>
>                 </condition>
>         </target>
>         <target name="core.dependency" depends="check.dependencies"
> unless="build.core">
>                 <ant dir="${dev.root}/${core.path}" inheritAll="false" />
>         </target>
>         <target name="build" depends="core.dependency">
>                 <ant antfile="${build.root}/product_build.xml"
> inheritAll="true" />
>         </target>
> this is a fairly simple example.  in some situations we have a
> deliverable that depends on 10-15 other JAR files.  so those build
> files become large rather quickly.  when new deliverables or
> dependencies are introduced there can be quite a bit of coding/logic
> involved to add them...
> ---------------------------------------------------------------------
> To unsubscribe, e-mail:
> For additional commands, e-mail:

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