2009-08-11 78 views
5

我想編寫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

<目標名稱= 「runJBoss」> \t \t \t \t \t \t <目標名稱= 「startApplication」> \t \t \t \t \t \t \t – 2009-08-11 13:06:12

回答

3

我的猜測是你在startServerexec任務。將spawn="true"添加到exec。然後,Ant將在後臺執行該命令並繼續而不用等待它完成。

2

我同意亞倫你可以使用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> 
0

您還需要了解直接執行.bat文件的問題。有關更多信息,請參閱<exec>任務的手冊頁。