Search code examples
javaantxmltask

xmltask in java 1.7?


Right now I am working on XMLTask using java 1.6. It is working fine with 1.6 but when I change from 1.6 to 1.7, it is throwing the following error:

NoClassDefFoundError: org/apache/xpath/XPathAPI

Solution

  • Had the same issue. I resolved it by adding xalan (specifically xalan-2.7.1.jar - there may be newer versions but that's what I had on hand) to the classpath when defining the taskdef:

    <taskdef name="xmltask" classname="com.oopsconsultancy.xmltask.ant.XmlTask">
        <classpath>
            <pathelement path="${basedir}/lib/xmltask-v1.13.jar"/>
            <pathelement path="${basedir}/lib/xalan-2.7.1.jar"/>
        </classpath>
    </taskdef>
    

    This seemed to make things work fine for me.