ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jean Morissette <>
Subject Re: AW: AW: Write Ant files for many modules
Date Tue, 14 Dec 2004 03:57:13 GMT wrote:
> Provide a <target> for each module and uses "depend"-attributes,
> so Ant can handle the dependency managing of the "targets" (here
> your modules) for you.

Let me describe my repository structure:

  |      +---build.xml
  |       +---build.xml
  |      +---build.xml
  |     +---build.xml
  |      +---build.xml
  |      +---build.xml
  |      +---build.xml
  |      +---build.xml

So, I have 8 modules.  Each module have its own build.xml.  Here is an 
exemple of the build.xml file of module 'adisk':

   <project name="adisk" default="jar">
     <path id="compile-classpath">
     <import file="../share.xml"/>

And here is share.xml:

<project name="share">

   <target name="set-properties">
     <property name="target" location="build"/>
     <property name="src" location="src"/>
     <property name="" value="module-${}.jar"/>

   <target name="setup" depends="set-properties">
     <mkdir dir="${target}/classes"/>
     <mkdir dir="${target}/lib"/>

   <target name="compile" depends="setup"
		description="Compile Java source files">
     <javac srcdir="${src}" destdir="${target}/classes">
       <classpath refid="compile-classpath"/>

   <target name="jar" depends="compile"
           description="Build jar file">
     <jar destfile="${target}/lib/${}"

   <target name="clean" depends="set-properties"
     description="Clean generated files">
     <delete dir="${target}"/>


I like that each module "import" share.xml, so it help to keep build.xml 
very short.

But, actually, to compile 'haboob' module, we need to execute the target 
'jar' for each module to which 'haboob' is dependent!  I want to handle 
module dependencies without executing the targets in a specific order.

I am a newbie with Ant, so could you explain to me how I can achieve 
that?  You have suggested that I write a target for each module and 
specify the module dependencies in the 'depend' attribute.  But, where 
should I write these targets?  In a master build file?  Maybe something 

in master.xml

   <target name="adisk" depends="sandstorm" />
   <target name="asocket" depends="sandstorm" />
   <target name="atls" depends="asocket" />
   <target name="gnutella" depends="asocket" />
   <target name="haboob" depends="atls, http, gnutella" />
   <target name="http" depends="asocket" />
   <target name="sandstorm" depends="util" />
   <target name="util" depends="" />

But what to do after?  Sorry, I don't understand your idea.  Could you 
explain more please?


To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message