ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Pardey, Craig" <CRAIG.PAR...@tdsecurities.com>
Subject RE: Exec JBoss - window not closed on exit
Date Wed, 16 Jun 2004 16:47:39 GMT

OK, I got it working by using a mixture of parallel and sequential tasks, and running JBoss
in the same window instead of in a new command window.

My build file (used by CruiseControl) is attached

<project name="build-cds" default="build" basedir="checkout/cds">

    <property name="jboss.home" value="/jboss-3.0.6_tomcat-4.1.18"/>
    <property name="jboss.port" value="8080"/>
    <property name="jboss.testpage" value="http://localhost:${jboss.port}/cds/index.jsp"/>
    
    <target name="build">
        <cvs command="up -d -P"/>
        <ant antfile="build.xml" target="clean"/>
        <ant antfile="build.xml" target="main"/>

        <antcall target="run-tests">
            <param name="jboss.script" value="run_junit.bat"/>
            <param name="ant.test.target" value="test-ejbs"/>
        </antcall>

        <antcall target="run-tests">
            <param name="jboss.script" value="run_dev_3.bat"/>
            <param name="ant.test.target" value="test-processors"/>
        </antcall>
    </target>

    <!-- 
         * Starts JBoss using the specified script
         * Waits until it is ready    
         * Runs the specified test case target
         * Shuts down JBoss
    -->
    <target name="run-tests">
        <parallel>
            <antcall target="start-jboss">
                <param name="script" value="${jboss.script}"/>
            </antcall>
            <sequential>
                <echo message="Waiting for JBoss to start..."/>
                <waitfor maxwait="5" maxwaitunit="minute" checkevery="5" checkeveryunit="second"
timeoutproperty="jboss.started">
                    <and>
                        <socket server="localhost" port="${jboss.port}"/>
                        <http url="${jboss.testpage}"/>
                    </and>
                </waitfor>
                <fail if="jboss.started" message="Problem starting JBoss using ${jboss.script}"/>
                <ant antfile="build.xml" target="${ant.test.target}"/>
                <antcall target="stop-jboss"/>
            </sequential>
        </parallel>
    </target>

    <target name="start-jboss">
        <exec executable="${jboss.home}/bin/${script}" dir="${jboss.home}/bin">
            <env key="NOPAUSE" value="true"/>
        </exec>
    </target>

    <target name="stop-jboss">
        <echo message="Shutting down JBoss..."/>
        <exec executable="cmd.exe" dir="${jboss.home}/bin" spawn="false">
            <arg line="/c shutdown.bat -u user -p pwd"/>
            <env key="NOPAUSE" value="true"/>
        </exec>

        <echo message="Waiting for JBoss to stop..."/>
        <waitfor maxwait="5" maxwaitunit="minute" checkevery="5" checkeveryunit="second">
            <and>
                <not><socket server="localhost" port="${jboss.port}"/></not>
                <not><http url="${jboss.testpage}"/></not>
            </and>
        </waitfor>
    </target>

</project>



-----Original Message-----
From: Donald Strong [mailto:dstrong@agentissoftware.com]
Sent: Tuesday, June 15, 2004 7:54 PM
To: Ant Users List
Subject: RE: Exec JBoss - window not closed on exit


Hi Craig,

Kieth has the correct solution, but you apply it to the startup
command AS WELL.
The DOS window stays open because it is waiting for a keystroke.
Setting NOPAUSE fixes that on both startup and shutdown.

Regards
Donald.

This is straight out of our jboss.xml file.

        <!--
        Start the desired appserver.  The start opertaion requires that the
        server.domain.dir property be set to the directory of the instance
        that is to be started.  The server.host and server.port properties
        are also used, but for informational purposes only.
     -->
    <target name="start" depends="-init"
     description="Start the App Server">
        <echo>Start appserver http://${server.host}:${webserver.port}</echo>
        <echo>APPSERVER STARTING</echo>
        <exec executable="${server.bin.dir}\run.bat"
                     dir="${server.bin.dir}"
                      os="Windows XP Windows 2000"
          resultproperty="server.exit-status"
             failonerror="false" >
           <env key="NOPAUSE" value="true"/>
        </exec>
        <echo>APPSERVER STOPPED WITH RESULT CODE:
${server.exit-status}</echo>
    </target>

     <!--
        Stop the desired application server.
     -->
    <target name="stop" depends="-init"
     description="Stop the App Server">
        <property name="shutdown.bat"
              location="${server.bin.dir}/shutdown.bat"/>
        <echo>Stop appserver http://${server.host}:${webserver.port}</echo>
        <echo>${shutdown.bat}"</echo>
        <exec executable="${server.bin.dir}\shutdown.bat"
                     dir="${server.bin.dir}"
                      os="Windows XP Windows 2000"
          resultproperty="server.exit-status"
             failonerror="false" >
           <env key="NOPAUSE" value="true"/>
        </exec>
    </target>

> -----Original Message-----
> From: Pardey, Craig [mailto:CRAIG.PARDEY@tdsecurities.com]
> Sent: Wednesday, 16 June 2004 2:53 AM
> To: Ant Users List
> Subject: RE: Exec JBoss - window not closed on exit
>
>
>
> Shutting down JBoss is not the problem.  The problem is that when
> JBoss does shut down it leaves the command window open.
>
> This becomes a problem in a continuous build situation because
> over a short period of time the build server ends up with loads
> of idle command windows open.
>
> -----Original Message-----
> From: Keith Hatton [mailto:khatton@axiomsystems.com]
> Sent: Tuesday, June 15, 2004 12:15 PM
> To: Ant Users List
> Subject: RE: Exec JBoss - window not closed on exit
>
>
> I use this fragment to stop JBoss:
>
> <exec dir="${jboss.home}/bin" executable="cmd.exe" os="Windows 2000">
>     <arg line="/c shutdown.bat -S"/>
>     <env key="NOPAUSE" value="true"/>
> </exec>
>


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org


Mime
View raw message