2015-10-05 3 views
7

में त्रुटि build.xml में चींटी कार्यों को चलाने के दौरान एंटी बिल्ड चलाने में विफल रहा। मैं कंसोल में निम्न त्रुटि मिला:"कार्य बनाने में विफल या एंटीलिब टाइप करें: org.apache.maven.artifact.ant: mvn" एंट

Buildfile: F:\Eclipse Projects\my_project\build.xml 
    [typedef] Could not load definitions from resource org/apache/maven/artifact/ant/antlib.xml. It could not be found. 

BUILD FAILED 
F:\my_project\build.xml:32: Problem: failed to create task or type antlib:org.apache.maven.artifact.ant:mvn 
Cause: The name is undefined. 
Action: Check the spelling. 
Action: Check that any custom tasks/types have been declared. 
Action: Check that any <presetdef>/<macrodef> declarations have taken place. 
No types or tasks have been defined in this namespace yet 

This appears to be an antlib declaration. 
Action: Check that the implementing library exists in one of: 
     -F:\eclipse\plugins\org.apache.ant_1.8.3.v20120321-1730\lib 
     -C:\Users\Lucky\.ant\lib 
     -a directory added on the command line with the -lib argument 

मैं ग्रहण प्लगइन का फ़ोल्डर में Maven-चींटी-कार्य जार फ़ाइल रखा जाता है और WinAnt ANT_HOME/lib निर्देशिका में है और यह भी classpath में शामिल थे। लेकिन यह मेरी समस्या का समाधान नहीं किया और this answer भी इस मुद्दे को हल नहीं कर सका।

उत्तर

15
  1. अपनी परियोजना के रूट में एक lib निर्देशिका बनाएं और इसके अंदर maven-ant-tasks.jar फ़ाइल जगह।
  2. अपने मेरी समस्या build.xml

<path id="maven-ant-tasks.classpath" path="lib/maven-ant-tasks-2.1.3.jar" /> 
<typedef resource="org/apache/maven/artifact/ant/antlib.xml" uri="antlib:org.apache.maven.artifact.ant" classpathref="maven-ant-tasks.classpath" /> 

ऊपर के चरणों को हल में आयात कथन को शामिल करें। उम्मीद है कि यह भविष्य में किसी के लिए सहायक होगा।

वैकल्पिक समाधान,

  • तुम भी ANT_HOME/lib फ़ोल्डर के अंतर्गत maven-ant-tasks.jar फ़ाइल जगह कर सकते हैं इस समस्या को हल करने के लिए।
  • या आप इसे ग्रहण प्लगइन्स फ़ोल्डर के नीचे प्राप्त कर सकते हैं।
    उदाहरण के लिए। eclipse\plugins\org.apache.ant_1.8.3.v20120321-1730\lib
0

मेरे मामले में, मैं पहले से ही निर्देशिका में Maven-चींटी-taksk.jar 'eclipse\plugins\org.apache.ant_1.8.3.v20120321-1730\lib'.

मैं ग्रहण का उपयोग कर रहा है, तो मैं क्या जरूरत थी, पर मेनू विंडोज> प्राथमिकताएं चींटी रनटाइम के लिए जाने के लिए किया था > चींटी> रनटाइम, "Ant Home Entries" का चयन करें, पर "Ant Home" बटन ई क्लिक चींटी होम निर्देशिका

'eclipse\plugins\org.apache.ant_1.8.3.v20120321-1730\lib' 

यह काम का चयन करें!

संबंधित मुद्दे