ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Hari Kodungallur" <>
Subject Re: Newbie question: how to recurse into subdirectories?
Date Sat, 12 Oct 2002 22:07:10 GMT

On Sun, 13 Oct 2002 Angelo Schneider wrote :
>I like to get down into my directory tree and create a 
>subdirectory in
>each directory.
>E.g. start is src/ with subdirectories: src/core src/model
>I like to have a task creating src/rcs, src/core/rcs and 
>Some things I do not understand with ant(and the documentation 
>that realy weak):
>a) why does this task recurse into all directories?
>   <target name="compile" depends="init"
>         description="compile the source " >
>     <!-- Compile the java code from ${src} into ${build} -->
>     <javac srcdir="${src}" destdir="${build}"/>
>   </target>

Because that is the way the task is defined!! Here note that the 
javac task is not equivalent to the javac compiler. It invokes the 
javac compiler. The taks is also programmed to know that it should 
look for all the *.java files under the srcdir directory (unless 
of course you explicitly specify the jave files) and compare it 
against the timestamps about the corresponding *.class files in 
the destdir. Its just programmed that way. You can get the ant 
source code and peep into the javac taks to see what it does. All 
these tasks are written in java, i think

>b) why does the task above know to work on *.class versus 
>files?(comparing timestamps and issuing a call to the compiler)
>Nowhere in the build file is a dependency between *.class and 
>c) this does of course not recure into directories:
>    <target name="rcs">
>         <mkdir dir="rcs"/>
>    </target>

See above answer. Its just programmed to create the directory only 
under the given directory. Again here the mkdir task is different 
 from the mkdir command on your shell.

>Basicly it is clear that this should not be intended here ... 
>comparing it with the javac task ... both seem to be 
>equivalent but the semantics is quite different(beyond 
>creation and compilation).
>So: where to get a hint about the basic concepts how ant works?
>E.g. the ** semenatics in pathes is rather wiered. A "ant for 
>authors" guide would be highly appreciated :-) (( yes, I have 
>read the
>ant documentation ))
>But more important, how do I create rcs subdirectories for my 
>tree with ant?

I do not think there is a taks which can do what you need. You can 
write a Java program to do what you need and call it from your ant 
build script by using the java taks or you can define your taks 
out of it using taskdef.

Give your Company an email address like
ravi @  Sign up for Rediffmail Pro today!
Know more.

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

View raw message