Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is it possible to exclude some targets from Ant targets while executing the script?

Tags:

java

ant

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?

like image 999
Rakesh Juyal Avatar asked Oct 19 '09 07:10

Rakesh Juyal


2 Answers

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

like image 135
jitter Avatar answered Oct 24 '22 21:10

jitter


Why not create another target for it?

<target name="buildAppNoDeploy" depends="init,copy-all-requiredfiles-local,wait-to-merge,compile,createWAR"/>
like image 41
kgiannakakis Avatar answered Oct 24 '22 22:10

kgiannakakis