Use Tomcat Library in Webapp project

2019-08-11 02:49发布

问题:

I have a web application that uses the Tomcat library. I have not copied the jars from the Tomcat library into the web-inf/lib directory.

Now when I run an ant build / testNG class, it throws an error since the concerned jars are not present under the web-inf/lib directory.

Is there any way (configuration) that I can use the Tomcat library for the running the ant build / testNG classes.

Thanks in advance,

Vivek

回答1:

In the <testng> task, just provide the tomcat libraries as additional classpath elements.

<TestNG>
    <classpath>
        <pathelement path="${classpath}"/>
        <pathelement location="path/to/tomcat/lib.jar"/>
    </classpath>
</TestNG>