Ant任务使我的服务器和应用程序的启动自动化

问题描述:

我想编写Ant任务来自动执行启动我的服务器的任务,然后使用我的应用程序的URL打开Internet Explorer。Ant任务使我的服务器和应用程序的启动自动化

显然我必须首先执行startServer任务,然后执行startApplication任务。

但是即使在启动服务器执行startApplication任务后,Ant仍然没有出现startServer任务。

基本上我想让Ant知道startServer不会结束,ANT必须从startServer任务和runstartApplication任务出来,而startServer任务在后台运行。

+0

你可以发布'startServer'任务吗? – 2009-08-11 12:55:44

+0

\t \t \t \t \t \t \t \t \t \t \t \t \t – 2009-08-11 13:06:12

我的猜测是你在startServerexec任务。将spawn="true"添加到exec。然后,Ant将在后台执行该命令并继续而不用等待它完成。

我同意亚伦你可以使用exec来做到这一点,你也可以使用waitfor来测试你的连接。

<exec executable="${jboss.startup.bat}" spawn="true"/> 
<echo>Waiting to start</echo> 
<waitfor maxwait="10" maxwaitunit="second" checkevery="5000"> 
<!-- try to detect when the server has started --> 
    <http url="${myurl}" /> 
</waitfor> 
<echo>Started</echo> 

您还需要了解直接执行.bat文件的问题。有关更多信息,请参阅<exec>任务的手册页。