2010-08-24 82 views
1

我有以下的蚂蚁片断蚂蚁执行所不工作

<macrodef name="webapp.start"> 
    <attribute name="name" /> 
    <sequential> 
     <!--deploy--> 
     <antcall target="[email protected]{name}" /> 
     <!--start server--> 
     <antcall target="tomcat-server-start" /> 
     <!--go to URL--> 
     <exec executable="firefox" os="Linux" > 
      <arg line="-new-tab http://localhost:${tomcat.port}/@{name}" /> 
     </exec> 
    </sequential> 
</macrodef> 

它启动服务器,但不打开浏览器。如果我将exec任务放在一个单独的目标中并运行它,它可以正常工作。我猜测启动服务器是一个没有结束的过程,下一个不会开始。如何解决这个问题?有没有一种方法可以将exec作为一个独立的进程启动。

回答

1

我猜测,开始是不结束进程的服务器,下一个没有开始

我会花一分钟,确保这种情况。使用pgrepps来确定您的流程要做什么。

如果您确认服务器永远不会结束,我会在后台启动命令“tomcat-server-start”(通过后缀为&的shell命令),除非在tomcat-服务器。或者,在顺序块中使用parallel块,如下所示:

<macrodef name="webapp.start"> 
    <attribute name="name" /> 
    <sequential> 
     <!--deploy--> 
     <antcall target="[email protected]{name}" /> 
     <parallel> 
      <!--start server--> 
      <antcall target="tomcat-server-start" /> 
      <!--go to URL--> 
      <exec executable="firefox" os="Linux" > 
       <arg line="-new-tab http://localhost:${tomcat.port}/@{name}" /> 
      </exec> 
     </parallel> 
    </sequential> 
</macrodef> 
+0

我的服务器必须在浏览器启动之前启动。所以我在并行中添加了一个waitfor任务。谢谢你的帮助。 – user373201 2010-08-25 03:47:44