I deal with similar problems by creating an external shell script that first runs normal targets, remembers return code, then runs "post" targets, and returns the remembered return code.

- Alexey.

[EMAIL PROTECTED] wrote:
I've got a simple ant file that I'm running from CruiseControl.
Basically, it has these elements in it:

<project name="needHelp" default="runTests" basedir="checkout/projedt">

<property name="shutdown" value="true"/>

<target name="startAS">
    <exec
      dir="C:/oc4j/j2ee/home"
      executable="C:/work/cruise/webServerStart.bat"
      os="Windows XP"
      spawn="true"/>
</target>

<target name="runTests" depends="startAS">
     <ant antfile="regressionTest_build.xml" target="testManager"/>
</target>

<target name="shutdownAS" if="shutdown">
    <exec
      dir="C:/oc4j/j2ee/home"
      executable="C:/j2sdk1.4.2_07/bin/java.exe"
      os="Windows XP"
      failifexecutionfails="false">
<arg line="-jar admin.jar ormi://localhost:23791 un pw -shutdown"/>
    </exec>
</target>
</project>

All of my tests are in regressionTest_build.xml under the testManager target.... So the issue is this: I need to force the "shutdownAS" target to run regardless of whether the tests passed or not. What's happening right now is that one of my tests is failing in the "runTests" target and so ant doesn't proceed any further in the "needHelp" project despite the presence of the "if" clause in the "shutdownAS" target. Note too that in my CruiseControl configuration script I specify that both "runTests" and "shutdownAS" targets are to be run by CruiseControl but it seems to be ignoring me.

Sure would appreciate knowing how I can make that "shutdownAS" target execute no matter what.

Thanks,
Scott

Attachment: smime.p7s
Description: S/MIME Cryptographic Signature

Reply via email to