ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Alexey N. Solofnenko" <A.Solofne...@mdl.com>
Subject Re: Unix commads behaving different in Ant task
Date Mon, 08 May 2006 17:44:39 GMT
There are many ways to do that. I like this:

<?xml version="1.0" encoding="UTF-8"?>
<project name="Test" default="all" basedir=".">
  <scriptdef name="file-list" language="jython">
    <element name="fileset" type="fileset"/>
    <attribute name="name"/>
<![CDATA[
#file-list
property=str(attributes.get("name"))
fs=elements.get("fileset").get(0)

items=[]
iter=fs.iterator()
while iter.hasNext():
  items.append(iter.next().name)

project.setProperty(property, "\n".join(items))
]]>
  </scriptdef>
  <target name="all">
    <file-list name="fs">
      <fileset dir="." includes="**/*.jar"/>
    </file-list>
    <echo>File list:${fs}</echo>
  </target>
</project>

- Alexey.

Venkat Kotu wrote:
> Hi,
>
>  
>
> I have a situation where in I need to find all the .jar files in  a
> directory and write it to a temp file. 
>
>  
>
> The command from the prompt is : find myDir/*.jar and it lists all the
> .jar files from myDir directory.
>
>  
>
> The ant target defined for the purpose is:
>
>  
>
> <target name="list.jars">
>
>             <exec os="unix" executable="find" outputproperty="temp.txt">
>
>                         <arg line="$basedir}/myDir/*.jar"/>
>
>             </exec>
>
>  </target>
>
>  
>
> This does not return any thing.
>
>  
>
> What I am doing wrong?
>
>  
>
> Thanks
>
> Venkat Kotu
>
>  
>
>  
>
>
>   

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


Mime
View raw message