You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by Tassilo Horn <ta...@member.fsf.org> on 2008/11/06 14:17:32 UTC
Run an ant task for each file in a directory
Hi all,
currently I have this target in my ant file:
--8<---------------cut here---------------start------------->8---
<target name="generateschemas">
<echo>generateschema started</echo>
<java classname="de.uni_koblenz.jgralab.utilities.tgschema2java.TgSchema2Java"
classpathref="classpath">
<arg line="-f ${schema.dir}/MinimalSchema.tg -p ${src.dir}"/>
</java>
<java classname="de.uni_koblenz.jgralab.utilities.tgschema2java.TgSchema2Java"
classpathref="classpath">
<arg line="-f ${schema.dir}/citymapschema.tg -p ${src.dir}"/>
</java>
<echo>generateschemas finished</echo>
</target>
--8<---------------cut here---------------end--------------->8---
What I really want is to execute the given `java' task for each and
every *.tg file in ${schema.dir}/. How would I do that?
Bye,
Tassilo
--
GNU Emacs is a text editor for Über-Geeks.
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org
Re: Run an ant task for each file in a directory
Posted by Tassilo Horn <ta...@member.fsf.org>.
Stefan Bodewig <bo...@apache.org> writes:
Hi Stefan,
>> What I really want is to execute the given `java' task for each and
>> every *.tg file in ${schema.dir}/. How would I do that?
>
> You can use <apply> and set up the java command line correctly,
> something like
Thanks, that did the trick!
Bye,
Tassilo
--
The phrase 'balls to the wall' was originally conceived to describe
Chuck Norris entering any building smaller than an aircraft hangar.
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org
Re: Run an ant task for each file in a directory
Posted by Stefan Bodewig <bo...@apache.org>.
On Thu, 06 Nov 2008, Tassilo Horn <ta...@member.fsf.org> wrote:
> What I really want is to execute the given `java' task for each and
> every *.tg file in ${schema.dir}/. How would I do that?
You can use <apply> and set up the java command line correctly,
something like
<apply executable="java">
<arg value="-cp"/>
<arg pathref="classpath"/>
<arg value="de.uni_koblenz.jgralab.utilities.tgschema2java.TgSchema2Java"/>
<arg value="-f"/>
<srcfile/>
<arg line="-p ${src.dir}"/>
<fileset dir="${schema.dir}" includes="*.tg"/>
</arg>
I realize that you really want an extension of <java> in the same way
that <apply> extends <exec> and in fact you are not the first one.
But such a task hasn't been written (yet?).
Stefan
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org
Re: Run an ant task for each file in a directory
Posted by Tassilo Horn <ta...@member.fsf.org>.
Mark Salter <ma...@talktalk.net> writes:
Hi Mark,
>> Yes, it looks like it would do. But I think I cannot force everybody
>> working on that project to install ant-contrib...
>
> It might be easier than getting them to install something else?
>
> The installation ( http://ant-contrib.sourceforge.net/#install )looks
> very straightforward, why would they resist given your need?
Ah, right. So I can simply add it to the project's lib dir and add a
reference in the build file. So nobody except me has to do anything.
That's good.
Thanks for the pointer,
Tassilo
--
Windows: So easy to admin, even a worm can do it.
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org
Re: Run an ant task for each file in a directory
Posted by Mark Salter <ma...@talktalk.net>.
Tassilo Horn wrote:
> Yes, it looks like it would do. But I think I cannot force everybody
> working on that project to install ant-contrib...
It might be easier than getting them to install something else?
The installation ( http://ant-contrib.sourceforge.net/#install )looks
very straightforward, why would they resist given your need?
Up to you of course.
--
Mark
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org
Re: Run an ant task for each file in a directory
Posted by Tassilo Horn <ta...@member.fsf.org>.
Mark Salter <ma...@talktalk.net> writes:
Hi Mark,
>> What I really want is to execute the given `java' task for each and
>> every *.tg file in ${schema.dir}/. How would I do that?
>
> Ant-contrib has a Foreach task, perhaps that will do you?
Yes, it looks like it would do. But I think I cannot force everybody
working on that project to install ant-contrib...
Thanks anyway,
Tassilo
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org
Re: Run an ant task for each file in a directory
Posted by Mark Salter <ma...@talktalk.net>.
Tassilo Horn wrote:
> What I really want is to execute the given `java' task for each and
> every *.tg file in ${schema.dir}/. How would I do that?
Ant-contrib has a Foreach task, perhaps that will do you?
--
Mark
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org