Phing 只执行默认目标

Phing does just the default target

我的 Phing 有问题。他只做默认的工作。有没有人遇到过这种行为?环境适用于 Windows 10。 感谢您的帮助。

<?xml version="1.0" encoding="UTF-8"?>
<project name="Test" default="start">
    <!-- ============================================  -->
    <!-- Target: start                                 -->
    <!-- ============================================  -->
    <target name="start">
        <echo msg="Start build" />
    </target>
    <!-- ============================================  -->
    <!-- Target: prepareDirectory                      -->
    <!-- ============================================  -->
    <target name="prepareDirectory" depends="start">
        <echo msg="Making directory build ./build" />
        <mkdir dir="./build" />
        <echo msg="Making directory install ./install" />
        <mkdir dir="./install" />       
    </target>       
    <!-- ============================================  -->
    <!-- Target: build                                 -->
    <!-- ============================================  -->
    <target name="build" depends="prepareDirectory">
        <echo msg="Copying files to build directory..." />

        <echo msg="Copying ./about.php to ./build directory..." />
        <copy file="./about.php" tofile="./build/about.php" />

        <echo msg="Copying ./browsers.php to ./build directory..." />
        <copy file="./browsers.php" tofile="./build/browsers.php" />

        <echo msg="Copying ./contact.php to ./build directory..." />
        <copy file="./contact.php" tofile="./build/contact.php" />
    </target>
</project>

你需要反过来设置依赖关系。您的目标 "start" 不会使用您当前的代码触发任何其他目标。

试试这个:

<?xml version="1.0" encoding="UTF-8"?>
<project name="Test" default="build">
    <!-- ============================================  -->
    <!-- Target: start                                 -->
    <!-- ============================================  -->
    <target name="start">
        <echo msg="Start build" />
    </target>
    <!-- ============================================  -->
    <!-- Target: prepareDirectory                      -->
    <!-- ============================================  -->
    <target name="prepareDirectory" depends="start">
        <echo msg="Making directory build ./build" />
        <mkdir dir="./build" />
        <echo msg="Making directory install ./install" />
        <mkdir dir="./install" />       
    </target>       
    <!-- ============================================  -->
    <!-- Target: build                                 -->
    <!-- ============================================  -->
    <target name="build" depends="prepareDirectory">
        <echo msg="Copying files to build directory..." />

        <echo msg="Copying ./about.php to ./build directory..." />
        <copy file="./about.php" tofile="./build/about.php" />

        <echo msg="Copying ./browsers.php to ./build directory..." />
        <copy file="./browsers.php" tofile="./build/browsers.php" />

        <echo msg="Copying ./contact.php to ./build directory..." />
        <copy file="./contact.php" tofile="./build/contact.php" />
    </target>
</project>

执行顺序为:start -> prepareDirectory -> build

希望有用!