我需要停止,部署我的ear文件,并使用Ant任务启动Jboss服务器。
我能够使用Ant任务成功地将J2EE应用程序作为耳文件编译,构建和部署到JBoss服务器中。我们可以在jboss控制台中看到我的应用程序的重新部署。我想在部署之前停止服务器并启动服务器。
有什么办法吗?
最佳答案
在这里,您如何启动/停止JBoss应用程序容器,包括部署应用程序:
<!-- 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 - 如何使用Ant任务启动和停止jboss服务器?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3060048/