ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From David McTavish <>
Subject RE: ant for dummies question
Date Tue, 10 Dec 2002 16:09:50 GMT

One of the benefits of setting src.dir as a property is that you could call
your compile script from an external script and override the value. This is
generally useful if you are provide professional services (ie:
UI/HTML/customization for your end-customer).

We have a root development folder that contains the core implementation with
a peer folder containing any work that may be different.


 +-- root project
 |   |
 |   +-- src
 +-- customer
     +- src

All of the build logic is contained within the root project's build script,
but we make calls from the customer build script to compile the code, BUT
override the src.dir property to be "../customer/src". This way, we don't
have to duplicate the build logic across every customer that we wish to

<target name="build">
    <ant dir="../root" target="compile"/>
    <ant dir="../root" target="compile">
        <param name="src.dir" value="../customer1/src"/>
    <ant dir="../root" target="build"/>

This means we don't have to duplicate the complicated intricacies of the
build and compile targets (building wars, pre-compiling jsp's, etc) and can
piggy-back on an existing framework. This has also GREATLY increased our
team's flexibility in being able to produce customized applications.


-----Original Message-----
From: Erik Hatcher [] 
Sent: Tuesday, December 10, 2002 10:31 AM
To: Ant Users List
Subject: Re: ant for dummies question

Adam Hardy wrote:
> I'm used to having my java classes in the "src" subdirectory. Yet I 
> was
> reading an old post "J2EE config/build best practices" from Drew Davison 
> recommending calling the source code dir "java" - which is more common?

Drew... one of my major mentors in the Java world!

As for naming conventions, its pretty arbitrary, but I see src most often.

> Also the struts-originated build.xmls hard-coded the directory name 
> in,
> but wouldn't it be better to have it in the
> Instead of
> <javac srcdir="src"
>        destdir="${build.home}/classes"
>          debug="${compile.debug}"
>    deprecation="${compile.deprecation}"
>       optimize="${compile.optimize}">
>   <classpath refid="compile.classpath"/>
> </javac>
> have this:
> <javac srcdir="${src}" ....

I disagree with making a property for everything - it just makes things 
too confusing and too indirected unnecessarily.  I hardcode in relative 
paths to my fixed directory structure pieces.  src never moves (relative 
to the project base directory, that is) so its perfectly reasonble to 
hard-code its relative path.

Don't get caught up in the "everything must be a property" mindset - 
only make properties for things that need to be flexible where they are 
written to or read from.


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

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

View raw message