2012-12-06 103 views
4

我使用Ant 1.8.2,我得到這個錯誤:如何使用CPP-任務Ant構建

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. 

我GOOGLE了它。並意識到螞蟻貢獻缺失。之後,我添加了ant-contrib-1.0b3.jar。但是這個jar不支持Ant 1.8.2並且我不知道使用cpp-tasks。我讀http://ant-contrib.sourceforge.net/cpptasks/index.html這個,但我沒有克服。

問候。

+1

任何想法?我無法使用Eclipse UI。 –

+2

你可以請包括你的構建文件等? – imrichardcole

+0

請列出您的構建文件...以及您爲什麼使用ant-contrib。通常有更好的方法來做事情比ant-contrib。 – thekbb

回答

0

我在你的classpath中沒有ant-contrib jar。 下載這個jar。 並轉到日食中的窗口首選項。 select ant-runtime-(Ant Home Entries(默認))選擇 添加外部罐子。在你的類路徑中包含jar ant-contrib按下ok。

你的build.xml應該喜歡這個

<?xml version="1.0" encoding="UTF-8"?> 
     <project name="JarCreation" default="Jar" basedir="." xmlns:ac="antlib:net.sf.antcontrib"> 
     <property name="array" value="a,b,c,d"/> 
     <target name="Jar"> 
     <ac:for list="${array}" param="letter"> 
     <sequential> 
     <echo>Your Code Here</echo> 
     <ac:var name="test" value="somethin"/> 
     </sequential> 
     </ac:for> 
     </target> 
     </project> 

**

它會跑!