2010-05-03 16 views

Odpowiedz

8

To naprawdę zależy od tego, co rozumiesz przez "zasadniczą różnicę". Różnica polega na tym, że jedna nazywa drugą, więc w zasadzie jest to samo, ale używane w różnych kontekstach.

Oto urywek z defaults.properties który definiuje standardowe zadania Ant:

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

Jeśli otwarcie kodu źródłowego tych zadań widać, że CallTarget zawiera Ant przedmiotu oraz delegatów większość prac na to:

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(); 
    } 
    .......... 
    .......... 
} 
Powiązane problemy