问题
I have several projects, most of them has "test" target, which run tests and store results in property 'test.faulire'.
All projects located in same directory:
- big_project / someproject1
- big_project / someproject1 / build.xml
- big_project / someproject2
- big_project / someproject2 / build.xml
So, in root of 'big_project' i want to create one build.xml for:
Running test on all projects
If all test ok, run "deploy" task on each project. It'll be very well if I could pass some deployment parameters to each project.
How would you realize this scenario ?
回答1:
You might have a look at the for task in ant-contrib. With it you could iterate over all directories like that:
<for param="dir">
<path>
<dirset dir="." includes="*"/>
</path>
<sequential>
<ant dir="${dir}" antfile="${dir}/build.xml" target="aTarget" />
</sequential>
</for>
回答2:
Have a look at the Ant manual page on the 'subant' task. The page contains examples on how to use the task the way you want to.
来源:https://stackoverflow.com/questions/2108862/ant-for-other-ants