what if you do:

<try>
   ...
   <catch>
     <echo...>
   </catch>
</try>

not sure if this is valid syntax, but seems to work in most cases for me
(although I am not doing nested make calls at this time sorry).
the only other thing I would think that it is would be a possible bug in
try/catch.

d.


-----Original Message-----
From: Nolan Ring [mailto:[EMAIL PROTECTED]]
Sent: Friday, January 24, 2003 3:28 PM
To: [EMAIL PROTECTED]
Subject: trycatch and recursive make





Hi,

As a part of our build process we are exec'ing a call to make ... which, 
in turn, calls make, which in turn calls make ... etc, etc, etc.

If the initial call to make from the build.xml fails trycatch catches 
the error and echos the correct message.  If, however, make fails 
several levels down, trycatch doesn't  return the "catch" message. 
Is there anyway to capture these errors from exec?

Here's the build.xml snippet:

 <target name="csrc" depends="init">
   <trycatch>
   <try>
      <exec executable="make" dir="${csrcDir}" resultproperty="result" >
          <arg line="-f Makefile.sun CSRC_ROOT=${csrcDir} 
AGENT_ROOT=${basedir}"/>
      </exec>
   </try>
   <catch>
      <echo>CAUGHT MAKE FAILURE</echo>
   </catch>

 </trycatch>
 </target>

The output if the exec of make fails immediately is the following:

csrc:
    [exec] make: Makefile: No such file or directory
    [exec] make: *** No rule to make target `Makefile'.  Stop.
[trycatch] Caught exception: exec returned: 2
    [echo] CAUGHT MAKE FAILURE
    [echo] Resultproperty is: 0

If a failure occurs deeper down in the make structure all I get is the 
following:
csrc:
    [exec] make[1]: Entering directory 
`/var/AccuRev_ws/marwks33_oriole_Plat_Int/agent/csrc/uagent/src'
    [exec] make[1]: Makefile: No such file or directory
    [exec] make[1]: *** No rule to make target `Makefile'.  Stop.
    [exec] make[1]: Leaving directory 
`/var/AccuRev_ws/marwks33_oriole_Plat_Int/agent/csrc/uagent/src'
    [exec] make[1]: Entering directory 
`/var/AccuRev_ws/marwks33_oriole_Plat_Int/agent/csrc/arp/server'
    [exec] make[1]: Makefile: No such file or directory
    [exec] make[1]: Leaving directory 
`/var/AccuRev_ws/marwks33_oriole_Plat_Int/agent/csrc/arp/server'
    [exec] make[1]: *** No rule to make target `Makefile'.  Stop.
    [echo] Resultproperty is: 0

Thanks for any help.

Nolan







--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to