tags:

views:

99

answers:

2

In ant if want to execute more than one target, we can do it like this,

ant target1 target2 target3

Other way could be, create target4 like

<target name="target4" depends="target1,target2,target3" />

but the problem is, one of my target definition is:

<target name="buildApp" depends="init,copy-all-requiredfiles-local,wait-to-merge,compile,createWAR,deployAll"/>

and if i want to execute buildApp then it will run all associated targets too, as obvious. Is it possible to execute the buildApp target without executing deployAll target?

+2  A: 

Why not create another target for it?

<target name="buildAppNoDeploy" depends="init,copy-all-requiredfiles-local,wait-to-merge,compile,createWAR"/>
kgiannakakis
certainly i can create another target, but i was not expecting this. :)
Rakesh Juyal
+5  A: 

A possibility would be add a condition to your deployAll target like this.

<target name="depolyAll" unless="doNotDeploy">
...
</target>

Then when you want to run buildApp without deployAll on the commandline just do

ant -DdoNotDeploy=true buildAll

btw. note that unless just checks if the property is set. Not what the value is.

But this behaviour should be documented and is a little obscure.

I would consider explicitly creating a second build target e.g. buildAllWithoutDeploy which just misses the deploy target

jitter
+1 fot *unless* thing. :)
Rakesh Juyal