通过<phingcall>调用的目标不会在调用目标中设置属性

And*_*c ॐ 7 phing scope

在下面的phing xml中,在"skel"目标内部,我检查应用程序是否已配置,如果不是,则调用configure目标,然后将配置应用于多个文件.

问题是db.host在phingcall之后没有设置属性,即使它是在propertyprompt之后设置的.

我错过了什么?

<!-- 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>
Run Code Online (Sandbox Code Playgroud)

Tom*_*mas 6

我认为phingcall将在内部创造一个新的环境.完成配置目标后,此环境超出范围.

这意味着您无法像建议的那样使用单独的配置目标.

唯一的解决方案可能是使配置目标创建一个供其他目标使用的配置文件.