First, let me apologize for the lengthy code. I was trying to put in as
much information as possible.
I'm actually trying to run this on a UNIX server. I'm new to the UNIX
environment, so correct me if I am wrong, but if I use the bash command,
will I not have to create and execute some sort of shell script? If this
is the case, I'm not sure if this will work for me. All I am trying to do
is execute a the cvs status command. Below is what I am trying to
accomplish if I was doing this from the command line:
cvs -d :pserver:[EMAIL PROTECTED]:cvs/build/logs status
opt/usr/bin/testfile.xml
This will return the following info:
===================================================================
File: Demo.xml Status: Up-to-date
Working revision: 1.8
Repository revision: 1.8
/cvs/1LCW-LiveCycle_Workflow/1LCW_Pilot/Customer/Demo/Demo/Demo.xml,v
Sticky Tag: c0467215_1LCW_Demo_07-22-08_1300_ReadyITE
(revision: 1.8)
Sticky Date: (none)
Sticky Options: (none)
All I am trying to get is the Working revision line and place it into a
property. The following line:
cvs -d :pserver:[EMAIL PROTECTED]:cvs/build/logs status
opt/usr/bin/testfile.xml | grep 'Working'
returns this:
Working revision: 1.8
I'm trying to take the line above and place it into a property so I can
later parse it to find the latest revision number. Hopefully, this helps
and clarifies what I am doing.
Thanks,
Ray Harper, Jr.
Software Engineer II
Wachovia Corporation
1525 West WT Harris Blvd. Charlotte, NC, 28270
Tel: 704-427-1717 ? Fax: 704-427-3234 ? Mailcode: NC1077
CONFIDENTIALITY NOTICE:
The information accompanying this email transmission may contain
confidential or legally privileged information that is intended only for
the use of the individual or entity named in this message. If you are not
the intended recipient, you are hereby notified that any disclosure,
copying, distribution or reliance upon the contents of this email is
strictly prohibited. If you receive this email in error, please notify the
sender immediately.
Krzysieq <[EMAIL PROTECTED]>
07/25/2008 10:33 AM
Please respond to
"Ant Users List" <[email protected]>
To
"Ant Users List" <[email protected]>
cc
Subject
Re: Error returned using <exec> task
The code pieces You pasted are quite lenghty, and most of my experience
comes from unix boxes, but I guess there might be a similarity.
<exec executable="cvs" failonerror="true"
outputproperty="build.xml.
>
> version.line">
> <arg line="-d${common.setup.cvsRoot} status
> ${app.lar.source.clientpath/${prop.cust.xml.basename}.xml | grep
> 'Working'"/>
This has no right to do whatever it is You want it to - at least on linux
it
wouldn't. There's an explanation on the ant website somewhere, so I won't
repeat all of it. In brief - if You want to pipe output to another
program,
You'd have to exec not the command You want, but the command environment.
So
in my case this usually was something like:
<exec executable="bash"><arg line="-c 'do_stuff |
do_some_more_stuff'"/></exec>
Otherwise the redirection of output/error streams doesn't work. At least
that's on linux, but I imagine it will be the same on windows. Besides
this,
I don't see why You might not be getting what You want. Hope I helped a
little.
Cheers,
Chris
2008/7/25 <[EMAIL PROTECTED]>
> Hi,
>
> I am having an issue trying to execute the cvs command in an Ant script
> using the built in <cvs> task element. In using this, I didn't know how
> to place the status information into a property. So, I decided to use
the
> <exec> task element. Below is the code I am executing:
>
> <if>
> <or>
> <equals arg1="${os.name}" arg2="Windows 2000"/>
> <equals arg1="${os.name}" arg2="Windows XP"/>
> </or>
> <then>
> <exec executable="cmd" failonerror="true"
> outputproperty="build.xml.version.line">
> <arg line='/c "cvs status
>
${quote}${app.lar.source.clientpath}/${prop.cust.xml.basename}.xml${quote}
> | findstr Working | findstr revision"'/>
> </exec>
> </then>
> <else>
> <exec executable="cvs" failonerror="true"
> outputproperty="build.xml.version.line">
> <arg line="-d${common.setup.cvsRoot} status
> ${app.lar.source.clientpath/${prop.cust.xml.basename}.xml | grep
> 'Working'"/>
> </exec>
> </else>
> </if>
> <propertyregex property="build.xml.version"
> input="${build.xml.version.line}"
> regexp="([0-9\.]*)$"
> select="\1"
> casesensitive="false"
> />
> <echo message="XML file version info LINE =
> '${build.xml.version.line}'"/>
> <echo message="XML file version info = '${build.xml.version}'"/>
>
> When I run the code, I get the following error:
>
> cvs.get.wfversion:
> [echo] 2008/07/25 09:00:22 Get CVS version information to
> generate the wfversion value.
> [echo] CVS Get the XML file version info:
> '${common.setup.source.clientpath}/Demo/Demo/Demo.xml'
>
> BUILD FAILED
> /scratch/srm/customer/build/CVSTest_ray/CustomerLar_build.xml:1364:
> Following error occured while executing this line
> /scratch/srm/customer/build/CVSTest_ray/CustomerLar_build.xml:498: exec
> returned: 1
>
> I have been looking at the Ant book I purchased (Pro Apache Ant) and
> several websites for error codes returned from the <exec> task element,
> but have come up short. As stated earlier, when I tried to use the
<cvs>
> task element, I get stuck when I try to place the information into
> property. Below is the code using the <cvs> task:
>
> <if>
> <or>
> <equals arg1="${os.name}" arg2="Windows 2000"/>
> <equals arg1="${os.name}" arg2="Windows XP"/>
> </or>
> <then>
> <exec executable="cmd" failonerror="true"
> outputproperty="build.xml.version.line">
> <arg line='/c "cvs status
>
${quote}${app.lar.source.clientpath}/${prop.cust.xml.basename}.xml${quote}
> | findstr Working | findstr revision"'/>
> </exec>
> </then>
> <else>
> <cvs
> cvsRoot="${common.setup.cvsRoot}"
> command="status
> ${app.lar.client.path}/${app.lar.client.source.filename} | grep
'Working'"
> failonerror="true"
> />
> </else>
> </if>
> <propertyregex property="build.xml.version"
> input="${build.xml.version.line}"
> regexp="([0-9\.]*)$"
> select="\1"
> casesensitive="false"
> />
> <echo message="XML file version info LINE =
> '${build.xml.version.line}'"/>
> <echo message="XML file version info = '${build.xml.version}'"/>
>
> At this point, I didn't know how to put the info returned into a
property.
> I know I could send it to a temp file, but I didn't want to add another
> step into the process. Any help would be greatly appreciated.
>
> Thanks,
>
> Ray Harper, Jr.
> Software Engineer II
> Wachovia Corporation
> 1525 West WT Harris Blvd. Charlotte, NC, 28270
> Tel: 704-427-1717 ? Fax: 704-427-3234 ? Mailcode: NC1077
>
> CONFIDENTIALITY NOTICE:
> The information accompanying this email transmission may contain
> confidential or legally privileged information that is intended only for
> the use of the individual or entity named in this message. If you are
not
> the intended recipient, you are hereby notified that any disclosure,
> copying, distribution or reliance upon the contents of this email is
> strictly prohibited. If you receive this email in error, please notify
the
> sender immediately.
>