Is it possible to exclude some targets from Ant targets while executing the script?
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 nam开发者_高级运维e="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?
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
Why not create another target for it?
<target name="buildAppNoDeploy" depends="init,copy-all-requiredfiles-local,wait-to-merge,compile,createWAR"/>
精彩评论