我制作了build.xml make master build.xml和make jar war ear files
现在我想使用apache ant
停止并从master build.xml文件启动jboss服务器然后复制所有的战争和耳朵
答案 0 :(得分:2)
这很简单
<!-- Start Jboss -->
<target name="start-jboss" description="Starts back-end EJB container" depends="prepare">
<exec executable="${jboss.bin.dir}/run.bat" spawn="false">
</exec>
<copy todir="destination of where you want the file to go" overwrite="true">
<fileset file="myfile.war" />
<fileset file="myfile.ear" />
</copy>
<echo>+-----------------------------+</echo>
<echo>| J B O S S S T A R T E D |</echo>
<echo>+-----------------------------+</echo>
</target>
<!-- Stop Jboss -->
<target name="stop-jboss" description="Stops back-end EJB container" depends="prepare">
<exec executable="${jboss.bin.dir}/shutdown.bat" spawn="false">
<arg line="-S" />
</exec>
<copy todir="destination to where you want the file to go" overwrite="true">
<fileset file="myfile.war" />
<fileset file="myfile.ear" />
</copy>
<echo>+-----------------------------+</echo>
<echo>| J B O S S S T O P P E D |</echo>
<echo>+-----------------------------+</echo>
</target>
希望这有用:)
答案 1 :(得分:1)
你可以从命令行远程停止jboss(我认为这就是你想要的),如图所示here
在本地,也就是说如果你在jboss运行的同一台机器上运行build-file,你可以用蚂蚁exec
命令