Ant Problem: failed to create task or type foreach 问题

用eclipse导出android时总是会出现有类没有导出的现象,感觉非常麻烦,就用ant些了脚本。在eclipse中运行脚本没问题。可是在命令行下运行会出现

Problem: failed to create task or type foreach问题。出问题的脚本是

	<taskdef resource="net/sf/antcontrib/antcontrib.properties" classpath="${path.build}/ant-contrib.jar"/>

是使用ant的一个扩展包的时候的问题。我在这里明明是写了jar包的文件夹了。但是还是说找不到。

后来发现吧classpath写绝对路径就能够了,不明确为什么?

	<taskdef resource="net/sf/antcontrib/antcontrib.properties" classpath="/home/lib/ant-contrib.jar"/>

这样在命令行运行就不会报错了!

原文地址:https://www.cnblogs.com/yutingliuyl/p/6788813.html