I have a problem with Phing. He only does the default job. Has anyone encountered such behavior? The environment works on Windows 10. Thank you for your help.
<?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>
You need to set dependencies the other way around. Your target "start" does not trigger any other targets with your current code.
Try this:
<?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>
The execution order will be: start -> prepareDirectory -> build
Hope that works!