ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Ivan \"Rambius\" Ivanov" <>
Subject Re: Unix commads behaving different in Ant task
Date Sat, 06 May 2006 06:43:46 GMT

--- 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.
You can use a pure Ant solution using <fileset> and
<fileset id="jar.files.od" dir="myDir">
  <include name="*.jar"/>
<pathconvert refid=""
<echo file="tempfile">${jar.files}</echo>

> The command from the prompt is : find myDir/*.jar
> and it lists all the
> .jar files from myDir directory.
Wildcards are expanded by the shell and not by the
unix commands. Usually the commands run with <exec>
and started via java.lang.Runtime.exec() so the shell
is not used, so no wildcards expansion happens.

> 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>

I believe it must be something like this:
<exec executable="sh">
  <arg line="find ${basedir}}/myDir/*.jar"/>

Of course it is better to use the pure ant solution.
Anyway, wildcards with <exec> is asked often (so it is
a FAQ candidate) and the last time it was asked was
about a week ago, so please take a look at the
archives for more information.


Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message