ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From <Jan.Mate...@rzf.fin-nrw.de>
Subject AW: Search a folder automatically?
Date Wed, 27 Aug 2008 05:19:26 GMT
This is not Ants job.
You have to set up a Continous Build system like CruiseControl or Hudson.
These systems check against scm (subversion, cvs, ...) for updates and start a build (Ant,
Maven, ...).

Simplest solution would be an endless loop which starts the build. As Ant works inkrementally
on most tasks, folowing builds would be faster. You also could tune that using <uptodate>
and <available> in combination with condition targets (<target if|unless>).
	@echo off
	cls
	:loop
	call ant
	sleep 5m
	goto loop


Jan

 

> -----Ursprüngliche Nachricht-----
> Von: David W [mailto:davidw589@yahoo.com] 
> Gesendet: Dienstag, 26. August 2008 20:30
> An: Ant Users List; David Weintraub
> Betreff: Re: Search a folder automatically?
> 
> Hi David, 
>  
> Thanks so much for your reply. I use apache-ant-1.7.1 on 
> Linux. I found that my old Java source code still got 
> compiled and run even though I left the old corresponding 
> compiled class file there. 
>  
> What I wanted Ant to do is to check a folder continuously (or 
> check the folder once every 3 or 5 minutes) to see if a new 
> source code comes. If it is, then it goes to do more work. 
> Otherwise it just either continue to search or go to sleep 
> again. Is this possible? 
>  
> Thanks again, 
>  
> David W.
>  
>  
>  
> 
> 
> --- On Tue, 8/26/08, David Weintraub <qazwart@gmail.com> wrote:
> 
> From: David Weintraub <qazwart@gmail.com>
> Subject: Re: Search a folder automatically?
> To: "Ant Users List" <user@ant.apache.org>, davidw589@yahoo.com
> Date: Tuesday, August 26, 2008, 10:03 AM
> 
> Take a look at "filesets". Also, in the <javac> task, you can
> specify
> a "src" directory. All *.java files in that directory will get
> compiled.
> 
> If someone creates a new *.java file in the "src" directory, and did
> not delete the corresponding *.class files, then the <javac> task will
> only compile that new *.java file. If you change the source code in
> one *.java file, the <javac> task will only compile that one file and
> leave the others alone (as long as you didn't delete the corresponding
> *.class files).
> 
> Almost all Ant tasks use timestamps to check whether or not it needs
> to do a particular task. For example, <copy> won't copy files if the
> files in the destination directory have a newer timestamp than the
> files in the source directory. <jar> won't rejar files if the
> timestamp of the jarfile is newer than all the source files that you
> specified are in that jarfile.
> 
> Take a look at the <javac> tasks below:
> 
> <javac
>     src="${source.dir}"
>     dest="${dest.dir}"
>     classpath="${classpath}"/>
> 
> <javac dest="${dest.dir}">
>     <src>
>         <fileset dir="${source.dir}"/>
>     </src>
>     <classpath>
>          <fileset dir="${class.dir}"/>
>     </classpath>
> </javac>
> 
> First of all, I always specify a "dest" directory. That way, I can
> easily create a clean target which simply deletes the ${dest.dir}.
> 
> The first one uses a single "src" directory (which isn't
> uncommon).
> The second form allows me to specify multiple source directories, and
> allows me to just put all the files needed for compiling into a single
> ${class.dir}. To change the classpath, all I have to do is change the
> files in the ${class.dir}.
> 
> I hope this answers your question.
> 
> --
> David Weintraub
> qazwart@gmail.com
> 
> 
> 
> On Tue, Aug 26, 2008 at 11:30 AM, David W <davidw589@yahoo.com> wrote:
> > Hi,
> >
> > I am a newbie in Ant field so I appreciate any replies from you.
> >
> > What I want to do is to let Ant search a folder 
> automatically. If a piece
> of source code (say, Java source code) is put into that 
> folder, then Ant finds
> the code and begin to do more work. Can anybody tell me how 
> to make Ant to
> search a folder automatically?
> >
> > Thanks so much!
> >
> > David
> >
> >
> >
> 
> 
> 
>       
> 

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org


Mime
View raw message