Apache ant buildfile looping

岁酱吖の 提交于 2019-12-08 13:45:43

问题


Lord of all beginners here.

I'm trying to make a target in a build.xml that restarts itself when it meets a certain condition. I've searched high and low and I can't come up with a solution to make the target...well...loop. I'm stuck on this and it's driving me crazy, so any help is welcomed.

Edit: This is the target I want to loop:

<target name="prog" description="executes program">
            <parallel>      
                <daemons>       
                 <exec executable="mch" />
                </daemons>
            </parallel> 
    <exec executable="calculator" inputstring="$var">
        <redirector output="log.txt" />
    </exec>
    <delete file="log.txt" />
</target>

The executable creates a file when it closes without finishing. So my loop condition would be if that file exists or not.


回答1:


Could you use waitfor task with checkevery

https://ant.apache.org/manual/Tasks/waitfor.html

Sounds similar to the example on the task page

<waitfor maxwait="3" maxwaitunit="minute" checkevery="500">
        <http url="http://localhost/myapp/index.html"/>
</waitfor>
waits up to 3 minutes (and checks every 500 milliseconds) for a web server on localhost to     serve up the specified URL.



回答2:


Solved the issue by using Repeat, an additional task from Antelope.

http://antelope.tigris.org/nonav/docs/manual/bk03ch24.html



来源:https://stackoverflow.com/questions/22483253/apache-ant-buildfile-looping

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!