ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Conelly, Luis (GNF, Contractor)" <Luis.Cone...@gnf.com>
Subject RE: Exec task in Ant 1.6.1
Date Wed, 14 Apr 2004 16:26:34 GMT
This is a snippet of code to call a bat file:

----------------
    <target name="execBat">
      <exec dir="./" executable="cmd.exe"  newenvironment="true">
        <arg value="/C"/>
        <arg value="callbuild.bat"/>
        <arg value="notify"/>
      </exec>
    </target>
----------------

and this is the bat file:

------------
@echo off

echo. ========================================================
echo. =         Call ant script to update Application        =
echo. ========================================================
echo.
echo.
echo. Call \setenv.bat
@call setenv ant
echo.
echo.

set ANT_BUILD_FILE=master-build.xml
if ""%1"" == ""update"" goto ant-update
if ""%1"" == ""notify"" goto ant-notify

REM update to QA
:ant-update
echo. Ready to update to QA
set ANT_TARGET=all-lite 
echo.
echo.
goto ant-execute

REM Notify about update to QA
:ant-notify
echo. Ready to notify about update to QA
set ANT_TARGET=update-notification 
echo.
echo.
goto ant-execute

:ant-execute
set ANT_LOG_OPS=-DMailLogger.properties.file ./MailLogger.properties -logger org.apache.tools.ant.listener.MailLogger

echo. Call %ANT_BUILD_FILE% script with tag %ANT_TARGET% %ANT_LOG_OPS%
echo.
echo.
echo.
@call ant -f %ANT_BUILD_FILE% %ANT_TARGET%
echo.
echo.
goto end

:end
echo. End of callbuild.bat
------------

HTH
Regards


-----Original Message-----
From: Conelly, Luis (GNF, Contractor) 
Sent: Wednesday, April 14, 2004 11:17 AM
To: Ant Users List
Subject: RE: Exec task in Ant 1.6.1


Maybe some of these messages can help you:

http://marc.theaimsgroup.com/?l=ant-user&m=104893196912661&w=2
http://marc.theaimsgroup.com/?l=ant-user&m=106860585724837&w=2
http://marc.theaimsgroup.com/?l=ant-user&m=106860836726736&w=2
http://ant.apache.org/manual/CoreTasks/apply.html

HTH
-Luis

-----Original Message-----
From: Rhino [mailto:rhino1@sympatico.ca]
Sent: Wednesday, April 14, 2004 11:08 AM
To: Ant Users List
Subject: Re: Exec task in Ant 1.6.1


The attempts I've made were unsuccessful; nothing at all was written to the
output file.

Do you have an example of running a .bat file from Ant? It doesn't need to
do DB2 stuff; a couple of 'dir' commands would do fine....

Rhino

----- Original Message ----- 
From: <Nick_Gianakas@sybari.com>
To: "Ant Users List" <user@ant.apache.org>
Sent: Wednesday, April 14, 2004 9:48 AM
Subject: Re: Exec task in Ant 1.6.1


> Hi Rhino,
>
> Have you tried putting all your tasks in a script file (.bat on Win32) and
> execute that script file from Ant?
>
> Regards,
> Nick G.
>
>
>
>
>
> "Rhino" <rhino1@sympatico.ca>
> 04/14/2004 09:36 AM
> Please respond to "Ant Users List"
>
>         To:     "ant-user" <user@ant.apache.org>
>         cc:
>         Subject:        Exec task in Ant 1.6.1
>
>
> Is it possible for an Exec task in Ant 1.6.1 to execute two or more
> commands in the same task?
>
> I am trying to take something that I do at the Windows XP command prompt
> and do it within an Ant script. Specifically, I do this:
> - launch a Windows XP command prompt via Start/All
> Programs/Accessories/Command Prompt
> - enter the following at the command prompt: db2cmd [This initializes the
> DB2 command line environment, making the next commands possible; they
> don't work at a normal command prompt.]
> - enter the following at the DB2 command prompt: db2 connect to sample
> - enter the following at the DB2 command prompt: db2 comment on specific
> procedure income_proc is 'xyz'
>
> I've tried pretty much everything you could imagine to imitate this in Ant
> but it never quite works.
>
> Unfortunately, although there are some DB2 commands that don't need a
> database connection before they will work, most DB2 commands *do* need a
> database connection, including the commands that I need to run. I think I
> need to get the connection and execute the command within the same task,
> although I could be wrong about that; perhaps I could get away with
> getting the connection in one task and then keep it open throughout the
> next task, which could contain the next command.
>
> Am I trying to do the impossible or have I just used the wrong technique?
>
> I'd really appreciate any suggestions that would help me get this working.
>
> Rhino
> ---
> rhino1 AT sympatico DOT ca
> "If you're getting something for nothing, you're not using your own credit
> card."
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
> For additional commands, e-mail: user-help@ant.apache.org
>


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

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message