I'm recently assigned a task to make ant be able to build war packages for different environments.
And I'm almost done. Except one feature.
The ant accepts an env
parameter by like -Denv=DEV
, and use different configuration files to make the war package. But the default target is start
which will build, deploy and start the tomcat. I don't want ant to deploy the war neither start the server when I pass in the -Denv=PROD
arg. I only want ant to build the ROOT.war. It's enough.
I know I can just type one more word to achieve this goal, but you know we are all lazy. :D
Does anyone know how to change the default target according to the command line argument? My requirements are:
ant -Denv=DEV
will build, deploy, and start the serverant -Denv=PROD
will only build the ROOT.war