Hi,
I think you just need to add the SHELL option:
staf local process start SHELL command "ant run.getKeyById"
If you had the following Ant build file:
$ cat c:/temp/abc.xml
<project name="TestAnt" default="main" basedir=".">
<target name="main">
<echo>Hello!</echo>
</target>
</project>
Here is a STAX job that runs this Ant build file:
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE stax SYSTEM "stax.dtd">
<stax>
<defaultcall function="main"/>
<function name="main">
<sequence>
<process>
<location></location>
<command mode="'shell'">'ant -buildfile c:/temp/abc.xml'</command>
<stderr mode="'stdout'"/>
<returnstdout/>
</process>
<if expr="RC != 0">
<log level="'error'">
'Process failed with RC=%s, Result=%s' % (RC, STAFResult)
</log>
<elseif expr="STAXResult != None">
<iterate var="fileInfo" in="STAXResult" indexvar="i">
<if expr="fileInfo[0] == 0">
<sequence>
<log level="'info'">fileInfo[1]</log>
</sequence>
<else>
<log level="'error'">
'Retrieval of file %s contents failed with RC=%s' % (i,
fileInfo[0])
</log>
</else>
</if>
</iterate>
</elseif>
<else>
<log level="'info'">'STAXResult is None'</log>
</else>
</if>
</sequence>
</function>
</stax>
After running this STAX job, the job user log will contain:
Buildfile: c:\temp\abc.xml
main:
[echo] Hello!
BUILD SUCCESSFUL
Total time: 0 seconds
Here is an example of running the Ant build from the command line via
STAF:
$ STAF local PROCESS START SHELL COMMAND "ant -buildfile c:/temp/abc.xml"
RETURNSTDOUT STDERRTOSTDOUT WAIT
Response
--------
{
Return Code: 0
Key : <None>
Files : [
{
Return Code: 0
Data : Buildfile: c:\temp\abc.xml
main:
[echo] Hello!
BUILD SUCCESSFUL
Total time: 0 seconds
}
]
}
Thanks,
David
David Bender
STAF/STAX Development
IBM Software Group, WPLC
11501 Burnet Rd.
Bldg. 903-5B002
Austin, TX 78758-3400
Phone (T/L): 1-512-286-5315 (363-5315)
ITN: 23635315
Email: [email protected]
From:
arul prakash <[email protected]>
To:
[email protected]
Date:
01/07/2010 02:39 AM
Subject:
Re: [staf-users] ant command in STAF
a STAX equivalent for this would also be helpful.
On Thu, Jan 7, 2010 at 2:02 PM, arul prakash <[email protected]>
wrote:
Hi,
Im trying to run an ant command by using the process service in
STAF.But I get the following error when I execute it.
C:\> staf local process start command "ant run.getKeyById"
Error submitting request, RC: 10
Additional info
---------------
Error starting the process. CreateProcess failed with OS RC 2: The system
cannot
find the file specified.
Invalid command: ant run.getKeyById
also,
C:\>staf local process start command ant run.getKeyById
Error submitting request, RC: 10
Additional info
---------------
Error starting the process. CreateProcess failed with OS RC 2: The system
cannot
find the file specified.
Invalid command: ant run.getKeyById
--
Regards,
Arul
--
Regards,
Arul
------------------------------------------------------------------------------
This SF.Net email is sponsored by the Verizon Developer Community
Take advantage of Verizon's best-in-class app development support
A streamlined, 14 day to market process makes app distribution fast and
easy
Join now and get one step closer to millions of Verizon customers
http://p.sf.net/sfu/verizon-dev2dev
_______________________________________________
staf-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/staf-users
------------------------------------------------------------------------------
This SF.Net email is sponsored by the Verizon Developer Community
Take advantage of Verizon's best-in-class app development support
A streamlined, 14 day to market process makes app distribution fast and easy
Join now and get one step closer to millions of Verizon customers
http://p.sf.net/sfu/verizon-dev2dev
_______________________________________________
staf-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/staf-users