Ant任务,用于自动启动我的服务器和应用程序

时间:2009-08-11 12:52:14

标签: ant

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

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

但是,即使在启动服务器执行startServer任务之后,Ant也没有从startApplication任务中出来。

基本上我希望Ant了解startServer不会结束,当startServer任务在后台运行时,ANT必须退出startServer任务和runstartApplication任务。

3 个答案:

答案 0 :(得分:3)

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

答案 1 :(得分:2)

我同意Aaron您可以使用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>

答案 2 :(得分:0)

您还需要直接了解exec'ing .bat文件的问题。请参阅&lt; exec&gt;的手册页。任务以获取更多信息。

相关问题