在不使用 spawn=true 的情况下在后台运行 Ant 目标 [英] Run Ant target in background without using spawn=true
本文介绍了在不使用 spawn=true 的情况下在后台运行 Ant 目标的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想在后台启动一个服务器,返回并执行其他一些目标,然后在 Ant 执行完所有目标后停止服务器.
I would like to start a server in background, go back and execute some other targets, and then stop the server when Ant finishes executing all targets.
我提出了以下两种解决方案,但它们都阻止 Ant 执行后续目标.
I have come up with the following two solutions but they both block Ant from executing the subsequent targets.
因为我希望进程最后死掉,所以我不想使用 spawn="true".还有其他解决办法吗?
Since I want the process to die in the end, I do not want to use spawn="true". Is there any other solution?
<target name="Start_Selenium_Server">
<java dir="lib" jar="lib/selenium-server-standalone-2.28.0.jar" fork="true">
<arg line="-singleWindow -userExtensions user-extensions.js"/>
</java>
</target>
<target name="Start_Selenium_Server">
<exec dir="lib" executable="java" newenvironment="true" output="./log/StartSeleniumServer.log">
<arg line="-jar selenium-server-standalone-2.28.0.jar -singleWindow -userExtensions user-extensions.js" />
</exec>
</target>
推荐答案
使用并行任务和守护进程嵌套元素包装调用
Wrap the call using the parallel task and the daemons nested element
<target name="Start_Selenium_Server">
<parallel>
<daemons>
<java dir="lib" jar="lib/selenium-server-standalone-2.28.0.jar" fork="true">
<arg line="-singleWindow -userExtensions user-extensions.js"/>
</java>
</daemons>
<parallel>
</target>
这篇关于在不使用 spawn=true 的情况下在后台运行 Ant 目标的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文