You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by "Tait, Allen" <at...@IDEXX.com> on 2001/09/05 19:58:57 UTC
ant task dir=
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.
Thanks
Re: ant task dir=
Posted by Matthew Inger <ma...@sedonacorp.com>.
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.
>
>Thanks
>
if you use ant1.4beta, you could do something like:
<target name="MaybeDoWindows" if="isWindows">
<!-- do some stuff here -->
</target>
<target name="MaybeDoUnix" if="isUnix">
<!-- do some stuff here -->
</target>
<target name="doIt">
<condition property="isWindows" value="true">
<or>
<os family="windows" />
<os family="dos" />
</or>
</condition>
<condition property="isUnix" value="true">
<os family="unix" />
</condition>
<antcall target="MaybeDoWindows" />
<antcall target="MaybeDoUnix" />
</target>
--
Matt Inger (matt.inger@sedonacorp.com)
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
Re: ant task dir=
Posted by Diane Holt <ho...@yahoo.com>.
--- "Tait, Allen" <at...@IDEXX.com> 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).
That's because on Windows, it's ant.bat, not ant. If you really want to
exec ant instead of doing an <ant>, you can specify the value for
"executable" as a property (eg., ${antcmd}), then set that property
according to the OS (various ways to do that).
> 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.
This should work. What error do you get? What happens if you point "dir"
to dir="${basedir}/content"? (You shouldn't have to, but if even that
doesn't work, then it could help you figure out why just giving the subdir
name doesn't either.) BTW: If the file you're <ant>'ing to is called
build.xml, you don't need to specify "antfile" -- only if it's something
other than that (just FYI).
Diane
=====
(holtdl@yahoo.com)
__________________________________________________
Do You Yahoo!?
Get email alerts & NEW webcam video instant messaging with Yahoo! Messenger
http://im.yahoo.com