Reputation: 491
I am a beginner in ANT.
What am I doing wrong? ant-contrib-1.0b3 , is available. I would like to call the default target as follows:
<target name="build">
<if>
<equals arg1="${config.name}" arg2="foo" />
<then>
<depends="get-all-war,..." />
</then>
<elseif>
<equals arg1="${config.name}" arg2="mark" />
<then>
<depends="zip-wars, ..." />
</then>
</elseif>
<else>
<depends="get-all-war, zip-wars, docs, deleteAll" />
</else>
</if>
Upvotes: 1
Views: 2235
Reputation: 1399
You can do the same thing smartly using macros. If your targets get-all-war, zip-wars, docs, deleteAll take more time you can run them in parallel like this :
<target name="build">
<if>
<equals arg1="${config.name}" arg2="foo" />
<then>
<mGetAllWar/>
</then>
<elseif>
<equals arg1="${config.name}" arg2="mark" />
<then>
<mZipWars />
</then>
</elseif>
<else>
<mRestAllTargets/>
</else>
</if>
<mGetAllWar>
<parallel>
<antcall name="target1">
<antcall name="target2">
...
</parallel>
</mGetAllWar>
<mZipWars >
<parallel>
<antcall name="target1">
<antcall name="target2">
...
</parallel>
</mZipWars >
<mRestAllTargets>
<parallel>
<antcall name="target1">
<antcall name="target2">
...
</parallel>
</mRestAllTargets>
Upvotes: 0
Reputation: 18704
you need to use antcall to execute other targets.
<target name="build">
<if>
<equals arg1="${config.name}" arg2="foo" />
<then>
<antcall target="get-all-war" />
<antcall target="..." />
</then>
<elseif>
<equals arg1="${config.name}" arg2="mark" />
<then>
<antcall target="zip-wars" />
<antcall target="..." />
</then>
</elseif>
<else>
<antcall target="get-all-war" />
<antcall target="zip-wars" />
<antcall target="docs" />
<antcall target="deleteAll" />
</else>
</if>
Upvotes: 3