Target called through <phingcall> does not set properties when calling the target
In the next phing xml inside the "skel" object, I check if the application is configured, if it is not, I call the configure target parameter and then apply the configuration to several files.
The problem is that the db.host property db.host not set after phingcall, even if it is set after theprompt property.
What am I missing?
<!-- base configuration --> <property name="paths.config" value="config" /> <property name="paths.config.file" value="${paths.config}/environment.ini" /> <available file="${paths.config.file}" property="configured" /> <target name="configure"> <if> <equals arg1="${configured}" arg2="true" /> <then> <echo message="Reconfigure ..." /> </then> <else> <echo message="Configure ..." /> </else> </if> <propertyprompt propertyName="db.host" defaultValue="localhost" promptText="Mysql Server Host" /> </target> <target name="skel"> <echo msg="Skel files..." /> <if> <equals arg1="${configured}" arg2="${configured}" /> <then> <echo message="Missing config file ..." /> <phingcall target="configure" /> </then> </if> <echo message="${db.host}" /> <copy todir="config"> <mapper type="glob" from="*.skel" to="*"/> <filterchain> <expandproperties /> </filterchain> <fileset dir="config"> <include name="*.skel" /> </fileset> </copy> </target> I think phingcall will create a new environment inside. When the configuration goal is completed, this environment goes beyond the scope.
This means that you cannot use a separate configuration setting as you suggest.
The only solution may be to configure to create a configuration file that is used by other purposes.
Properties set inside goals are tied to those goals and are not available outside their parent goals.
From the documentation for PropertyTask :
Important note about the scope: when the
<property>tag is called inside the<phingcall>, any properties are set in the new local scope. Thus, any properties or other variables set inside this area will cease to exist (or return to their previous value) after the completion of the parent<phingcall>.