我收到一个错误Could not load definitions from resource net/sf/antcontrib/antcontrib.properties. It could not be found.
Could not load definitions from resource net/sf/antcontrib/antcontrib.properties. It could not be found.
当我试图Ant构建于Eclipse。 所以,我下载了蚂蚁的contrib-0.6.jar,并保持它在我的/lib
的Apache Ant的位置,但它仍然没有解决我的问题。 我也通过指定试图/lib
中我的位置CLASSPATH
系统变量。 我怎样才能解决这个问题?
Answer 1:
您可以提供明确使用“类路径”元素的完整路径蚂蚁的contrib JAR:
<taskdef resource="net/sf/antcontrib/antlib.xml">
<classpath>
<pathelement location="${path-to-ant-contrib}/ant-contrib-1.0b3.jar"/>
</classpath>
</taskdef>
Answer 2:
从这个StackOverflow的页面缺少一个重要的事情是设置正确的ANT_HOME的环境变量是绝对关键和重要的,如果没有这个设置蚂蚁将作为您的文件系统讲述了同样的错误,无论在哪里,你复制蚂蚁的contrib-1.0b3.jar 。 这种缺少的东西已经成本核算我几个小时。 =)
不过,我收到此错误,而不蚀,在纯蚂蚁。
Answer 3:
我固定的是这样的:
该JAR加入Ant运行时类路径条目。
Window>Preferences>Ant>Runtime>Classpath
该JAR添加到任何Ant主项或全球条目。
Answer 4:
这样看来,你没有安装蚂蚁的contrib罐子到正确的lib目录。 这可能是困难的,如果你有ANT的一些设施做。
我的建议是你的ANT插件安装到“$ HOME /赵军阳张志利/ lib”目录。 你可以走一步,并自动执行的过程如下:
<project name="ant-contrib-tasks" default="all">
<taskdef resource="net/sf/antcontrib/antlib.xml"/>
<target name="bootstrap">
<mkdir dir="${user.home}/.ant/lib"/>
<get dest="${user.home}/.ant/lib/ant-contrib.jar" src="http://search.maven.org/remotecontent?filepath=ant-contrib/ant-contrib/1.0b3/ant-contrib-1.0b3.jar"/>
</target>
<target name="all">
<for param="file">
<fileset dir="." includes="*.txt"/>
<sequential>
<echo message="Found file @{file}"/>
</sequential>
</for>
</target>
</project>
Answer 5:
使用下面提到的代码在生成XML:
<path id="ant.classpath">
<pathelement location="${ant.jarPath}/ant.jar" />
<pathelement location="${ant.jarPath}/ant-contrib-0.3.jar" />
</path>
<taskdef resource="net/sf/antcontrib/antcontrib.properties">
<classpath refid="ant.classpath" />
</taskdef>
而在你构建属性文件:
ant.jarPath = d:/ antjars
和地点的ant.jar和蚂蚁的contrib-0.3.jar目录:d:/ antjars
Answer 6:
检查您已经阅读了蚂蚁的contrib jar文件的权限。
在复制另一个用户事与愿违的文件,让同样的错误信息后,我们的情况。
文章来源: Getting an error “Could not load definitions from resource net/sf/antcontrib/antcontrib.properties. It could not be found.”