You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by Frot <fr...@lycos.at> on 2002/06/08 14:24:41 UTC

Looping through files in the buildfile

Hi all,

I have two seperate, but simular. problems.


First I would like to create a classpath dynamically using all available library files present in the projects "./lib" directory.
The classpath (or a property) will look like './lib/mylib.jar,./lib/junit.jar'
I have seen a mail once solving this for the classpath part, but never for the property....
Can someone give an example for both options classpath an property ?


Secondly I would like to call a task for every file present in a directory, somthing like :

	<loop dir="./database_scripts" files="*.sql">
		<echo message="processing file : ${FILE}" />
		<antcall target="executeSQL">
			<param name="sqlfile" value="${FILE}" />
		</antcal>
	</loop>

note : where ${FILE} is ofcourse each time a different file name.
I guess this would need some special task (loop)  to be implemented, any suggestions on how to tackle this ???

Thanx,

Fred


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: Looping through files in the buildfile

Posted by Diane Holt <ho...@yahoo.com>.
--- Frot <fr...@lycos.at> wrote:
> First I would like to create a classpath dynamically using all available
> library files present in the projects "./lib" directory.
> ...
> Can someone give an example for both options classpath an property ?

Do it as a path, give the path an id, then refid that in a <property>.

> Secondly I would like to call a task for every file present in a
> directory, 

Sourceforge's ant-contrib project's ForEach task.

Diane

=====
(holtdl@yahoo.com)



__________________________________________________
Do You Yahoo!?
Yahoo! - Official partner of 2002 FIFA World Cup
http://fifaworldcup.yahoo.com

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>