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.
>

Reply via email to