ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Matthew Inger <>
Subject Re: ant task dir=
Date Wed, 05 Sep 2001 18:23:26 GMT
Tait, Allen wrote:

>I am modifying our build.xml files to work in both the Unix and Windows
>environments.  They were written originally for Unix.  We are executing a
>few subprojects within the main build.xml.  This has been accomplished with:
><exec dir="content" executable="ant"/>
>This is called from the parent directory of "content".  However, this
>command doesn't seem to work in Windows (it can't find ant).  It does work
>in Unix.  I have tried using the following to replace this command:
><ant dir="content" antfile="build.xml"/>
>Now this works fine in Windows but not in Unix.  The main build.xml is one
>level above "content" in the directory hierarchy.  I am guessing that when
>using the ant task the working directory does not get switched to "content"
>but it does get switched to "content" when using exec.  Is this the case?
>Is there a workaround?  I could specify the OS for the exec but this is not
>an option for the ant task.
if you use ant1.4beta, you could do something like:

<target name="MaybeDoWindows" if="isWindows">
  <!-- do some stuff here -->

<target name="MaybeDoUnix" if="isUnix">
  <!-- do some stuff here -->

<target name="doIt">
 <condition property="isWindows" value="true">
    <os family="windows" />
    <os family="dos" />

 <condition property="isUnix" value="true">
  <os family="unix" />

  <antcall target="MaybeDoWindows" />
  <antcall target="MaybeDoUnix" />


Matt Inger (
Sedona Corporation
455 S. Gulph Road, Suite 300
King of Prussia, PA 19406
(484) 679-2213
"Self-respect - the secure feeling that no one,
 as yet, is suspicious." -H.L. Mencken 

View raw message