ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Peter Reilly <peter.rei...@corvil.com>
Subject Re: scriptdef documentation - usage examples
Date Mon, 16 Feb 2004 14:28:46 GMT
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


Mime
View raw message