2010-05-03 20 views

risposta

8

Dipende davvero da cosa intendi per "differenza sostanziale". La differenza sarebbe che uno chiama l'altro, quindi fondamentalmente è la stessa cosa ma usata in diversi contesti.

Ecco un frammento da defaults.properties che definisce i compiti Ant standard:

ant=org.apache.tools.ant.taskdefs.Ant 
antcall=org.apache.tools.ant.taskdefs.CallTarget 
........... 

Se si apre il codice sorgente di queste attività si vedrà che CallTarget contiene un oggetto Ant e delega la maggior parte del lavoro da it:

public class CallTarget extends Task { 
    private Ant callee; 
    ........... 
    ........... 
    /** 
    * Delegate the work to the ant task instance, after setting it up. 
    * @throws BuildException on validation failure or if the target didn't 
    * execute. 
    */ 
    public void execute() throws BuildException { 
     if (callee == null) { 
      init(); 
     } 
     if (!targetSet) { 
      throw new BuildException(
       "Attribute target or at least one nested target is required.", 
       getLocation()); 
     } 
     callee.setAntfile(getProject().getProperty("ant.file")); 
     callee.setInheritAll(inheritAll); 
     callee.setInheritRefs(inheritRefs); 
     callee.execute(); 
    } 
    .......... 
    .......... 
} 
Problemi correlati