Reputation: 82599
If I have three targets, one all
, one compile
and one jsps
, how would I make all
depend on the other two?
Would it be:
<target name="all" depends="compile,jsps">
...or would it be:
<target name="all" depends="compile","jsps">
Or maybe something even different?
I tried searching for example ant scripts to base it off of, but I couldn't find one with multiple depends.
Upvotes: 40
Views: 43071
Reputation: 420
An alternate way is to use antcall which is more flexible if you want to run the depending targets in parallel. Assuming compile and jsps can be run in parallel (i.e in any order), all target can be written as:
<target name="all" description="all target, parallel">
<parallel threadCount="2">
<antcall target="compile"/>
<antcall target="jsps"/>
</parallel>
</target>
Note that if targets can not be run in parallel, it is preferable to use the first flavor with depend attribute because antcalls are resolved only when executed and if the called target does not exists, the build will fail only at that point.
Upvotes: 5
Reputation: 41165
<target name="all" depends="compile,jsps">
This is documented in the Ant Manual.
Upvotes: 10
Reputation: 33956
The former:
<target name="all" depends="compile,jsps">
This is documented in the Ant Manual.
Upvotes: 73
Reputation: 9110
It's the top one.
Just use the echo tag if you want to quickly see for yourself
<target name="compile"><echo>compile</echo></target>
<target name="jsps"><echo>jsps</echo></target>
<target name="all" depends="compile,jsps"></target>
You can also look at the antcall tag if you want more flexibility on ordering tasks
Upvotes: 11