In my ant script, I have target, which zipped a project. How can I start another target after this target finished?
Thanks a lot!
Let's assume the target you have is zip-project
and the next target you want to execute is next-target-for-something
One way of doing this is using antcall
<target name="zip-project">
<!-- Your Zipping Task-->
<antcall target="next-target-for-something"/>
</target>
Remember antcall
can be invoked inside a target
only
Another way of doing this is using depends
You would have something like:
<target name="zip-project" >
<!-- Your Zipping Task-->
</target>
Now define the next task as
<target name="next-target-for-something" depends="zip-project" >
<!-- Your Next Task-->
</target>
though this works in opposite manner of what you would have asked. So you need to call the ant like...
ant -buildfile <build.xml> next-target-for-something
and it will make sure that first zip-project
is completed and then next-target-for-something
will be executed.
Hope this helps!!
You can use depencencies to achive this. Here is an example:
<target name="nextstep" depends="target">
[Do what ever ...]
</target>
This will run after target has been finished if you run "ant nextstep".
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.