Ant -lib not working
开发者_运维技巧I'm trying to use the -lib
option to specify a directory containing Ant tasks. But they're not loading. For example:
$ ant -lib /path/to/libraries
Buildfile: build.xml
BUILD FAILED
/path/build.xml:3: taskdef class com.oopsconsultancy.xmltask.ant.XmlTask cannot be found
The build file contains:
<project name="test">
<taskdef name="xmltask" classname="com.oopsconsultancy.xmltask.ant.XmlTask" />
</project>
This is failing on RHEL5, but the exact same thing works on several other operating systems that I've tried.
When I add the --execdebug
flag, I get this:
exec "/usr/local/jdk1.6.0_20/bin/java" -classpath "/usr/share/java/ant.jar:/usr/share/java/ant-launcher.jar:/usr/share/java/jaxp_parser_impl.jar:/usr/share/java/xml-commons-apis.jar:/usr/local/jdk1.6.0_20/lib/tools.jar" -Dant.home="/usr/share/ant" -Dant.library.dir="/usr/share/ant/lib" org.apache.tools.ant.launch.Launcher -cp "" "-lib" "lib"
Any ideas?
Others seem to have the same problem on RHEL.
One workaround suggested here is to set your jar in the taskdef like so
<taskdef name="xmltask" classname="com.oopsconsultancy.xmltask.ant.XmlTask"
classpath="xmltask.jar"/>
Also see this thread which was a corrupt ant package
精彩评论