You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by Mark Lybarger <Ma...@CBC-Companies.com> on 2004/02/16 14:29:49 UTC
scriptdef documentation - usage examples
i'm looking for examples of the scriptdef task usage. my desire to use this task is that i have a need to loop through all the beans in a directory and call a deploy ant task. is this possible with the scriptdef? what i'm looking for is a way to call another local task from w/i the scriptdef. and how to pass values to that task. i'm familiar with java script, but could give another scripting a whirl if it's more suited.
thanks!
~mark
---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.574 / Virus Database: 364 - Release Date: 1/29/2004
Re: scriptdef documentation - usage examples
Posted by Peter Reilly <pe...@corvil.com>.
Mark Lybarger wrote:
>i'm looking for examples of the scriptdef task usage. my desire to use this task is that i have a need to loop through all the beans in a directory and call a deploy ant task. is this possible with the scriptdef? what i'm looking for is a way to call another local task from w/i the scriptdef. and how to pass values to that task. i'm familiar with java script, but could give another scripting a whirl if it's more suited.
>
>
Something like this:
<scriptdef name="deploybeans" language="beanshell">
<element name="beans" type="path"/>
<![CDATA[
files = elements.get("beans").get(0).list();
for (i = 0; i < files.length; ++i) {
t = project.createTask("echo");
t.setMessage("File is " + files[i]);
t.execute();
}
]]></scriptdef>
<deploybeans>
<beans>
<fileset dir="." includes="*.bean"/>
</beans>
</deploybeans>
Or use <for> from antcontrib
<ac:for param="file" xmlns:ac="antlib:net.sf.antcontrib">
<ac:path>
<ac:fileset dir="." includes="*.bean"/>
</ac:path>
<ac:sequential>
<echo>File is @{file}</echo>
</ac:sequential>
</ac:for>
Peter
>thanks!
>~mark
>
>---
>Outgoing mail is certified Virus Free.
>Checked by AVG anti-virus system (http://www.grisoft.com).
>Version: 6.0.574 / Virus Database: 364 - Release Date: 1/29/2004
>
>
>
>
>------------------------------------------------------------------------
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
>For additional commands, e-mail: user-help@ant.apache.org
>
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org