如何使用 Ant 任务启动和停止 jboss 服务器? [英] How to start and stop jboss server using Ant task?

查看:35
本文介绍了如何使用 Ant 任务启动和停止 jboss 服务器?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要停止、部署我的 ear 文件并使用 Ant 任务启动 Jboss 服务器.

I need to stop, deploy my ear file and start Jboss server using the Ant tasks.

我能够使用 Ant 任务成功地编译、构建和部署我的 J2EE 应用程序作为 Ear 文件到 JBoss 服务器中.我们可以在 jboss 控制台中看到我的应用程序的重新部署.我想在部署前停止服务器并启动服务器.

I am able to compile, build and deploy my J2EE application as an ear file into the JBoss server successfully using Ant tasks. We can see the redeployment of my application in the jboss console. I want to stop the server before deployment and start the server.

有没有办法做到这一点?

Is there any way to do this ?

推荐答案

这里是如何启动/停止 JBoss 应用容器,包括部署应用:

Here how you start/stop JBoss app container including deploy an application :

<!-- Stop Jboss -->
<target name="stop-jboss" description="Stops back-end EJB container" >
    <exec executable="${jboss.bin.dir}/shutdown.bat" spawn="true">
        <arg line="-S" />
    </exec>
    <echo>+-----------------------------+</echo>
    <echo>| J B O S S   S T O P P E D   |</echo>
    <echo>+-----------------------------+</echo>
</target>

<!-- Start Jboss -->
<target name="start-jboss" description="Starts back-end EJB container" >
    <exec executable="${jboss.bin.dir}/run.bat" spawn="true">
    </exec>
    <echo>+-----------------------------+</echo>
    <echo>| J B O S S   S T A R T E D   |</echo>
    <echo>+-----------------------------+</echo>
</target>

<!-- deploy target-->
<target name="deploy-war" description="deploy war file" depends="prepare">
  <sequential>
    <antcall target="stop-jboss" />
    <war destfile="${file.name}" webxml="conf/web.xml">
       <classes dir="bin" />
    </war>
    <antcall target="start-jboss" />
        <echo>+----------------------------+</echo>
        <echo>|   W A R  D E P L O Y E D   |</echo>
        <echo>+----------------------------+</echo>
  </sequential>
</target>

希望这有帮助:)

这篇关于如何使用 Ant 任务启动和停止 jboss 服务器?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆