Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / Tools / April 2005

Tip: Looking for answers? Try searching our database.

Ant multi OS <exec> advice

Thread view: 
Meetlint - 07 Apr 2005 18:22 GMT
Hi,

I have the following Ant code which I would like to also use on Linux:

<target name="build.XmlJaxb">
    <exec dir="${checkout.dest}/XmlJaxb" executable="cmd">
        <arg line="/C ant -logger org.apache.tools.ant.XmlLogger
-logfile ant_log_dist.xml dist" />
    </exec>
</target>

For Linux I woul dneed to replace "cmd" and "/C" with "bash" or something?

I know there is the <exec> OS option but then I would need to copy the
<exec> tags with a Windows and Linux version. Gives maintenance errors.

I know I could make variables for "cmd" and "/C" and use the <if>
contrib to look at the os Java system property.

I cannot use <ant> task because I do not seem to be able to specify the
Xml logger and the output file.

any ideas?

thanks,
Peter
"." - 08 Apr 2005 17:15 GMT
> Hi,
>
[quoted text clipped - 19 lines]
>
> any ideas?

I usually do something like:

    <condition property="cmd" value="cmd.exe>
        <os family="windows"/>
    </condition>
    <property name="cmd" value="bash"/>

Now I can use ${cmd} for the executable. I can do the same thing for the
command line arguments.

The way it works is, if the condition (os family="windows") is true then
cmd=cmd.exe. The <property> tag will do nothing if cmd is already set. If
the condition is false then the <property> tag will set cmd=bash.

Signature

Send e-mail to: darrell dot grainger at utoronto dot ca



Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.