2017-07-07 2 views
0

J'ai un problème avec Phing. Il fait seulement le travail par défaut. Quelqu'un at-il rencontré un tel comportement? L'environnement fonctionne sur Windows 10. Nous vous remercions de votre aide.Phing fait juste la cible par défaut

<?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> 

Répondre

1

Vous devez définir les dépendances dans l'autre sens. Votre cible "start" ne déclenche aucune autre cible avec votre code actuel.

Essayez ceci:

<?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> 

L'ordre d'exécution sera: début -> prepareDirectory -> construire

Espoir qui fonctionne!

+0

Cela fonctionne. Merci de votre aide. Je comprends déjà comment fonctionne la cible par défaut. –

+0

Pouvez-vous marquer la réponse comme acceptée, si c'est ce que vous cherchiez? – arifCee

+1

Je suis désolé pour ça. Je suis nouveau sur 'StackOverflow'. Je ne connais pas encore tous les mécanismes. –