2010-05-03 18 views
12

क्या एंटी टास्क एक अलग बिल्ड फ़ाइल पर चलता है, इस तथ्य को छोड़कर, एंटीकॉल कार्य (वर्णित here) और चींटी कार्य (वर्णित here) के बीच कोई महत्वपूर्ण अंतर है?एंटीकॉल और चींटी कार्यों के बीच क्या अंतर है?

+1

आपके द्वारा अभी उल्लेखित लिंक में मतभेदों का वर्णन किया गया है। – skaffman

उत्तर

8

यह वास्तव में "पर्याप्त अंतर" से आपका क्या मतलब है इस पर निर्भर करता है। अंतर यह होगा कि एक दूसरे को बुलाता है, इसलिए मूल रूप से वही बात है लेकिन विभिन्न संदर्भों में उपयोग की जाती है।

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

आप इन कार्यों के स्रोत कोड को खोलने अगर आपको लगता है कि CallTarget एक Ant वस्तु और प्रतिनिधियों के लिए काम की सबसे अधिक होता है देखेंगे:

यहाँ जो मानक चींटी कार्यों को परिभाषित करता है defaults.properties से एक टुकड़ा है यह:

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(); 
    } 
    .......... 
    .......... 
} 
संबंधित मुद्दे