Answer the question
In order to leave comments, you need to log in
Specifying an additional argument for ant or phing
Question for everyone who uses ant or phing.
I want to write a script that will deploy some project to a server. At the same time, in the task launch line, I want to be able to specify a variable that will indicate in which environment I am going to deploy (test, production, etc.). I would like it to look something like this:
phing deploy test
Where deploy is the name of the task, of course, and test is a variable pointing to the environment.
My question is how can ant or phing intercept the value of the second argument (after the task name)?
Answer the question
In order to leave comments, you need to log in
Can I do separate tasks in the ante? How many deployment types do you have...
You can pass parameters to phing with -D. Doesn't look very nice - but without crutches IMHO
<target name="test_env">
<echo>${environment}</echo>
</target>
[email protected]:~/***$ phing test_env -Denvironment=test1
Buildfile: ****/build.xml
**** > test_env:
[echo] test1
BUILD FINISHED
Total time: 0.0969 seconds
For ant: (most cut out)
ant [options] [target [target2 [target3] ...]]
Options:
-D<property>=<value> use value for given property
-propertyfile <name> load all properties from file with -D
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question