我正在尝试在ant中为Tomcat定义一个taskdef。
<taskdef name="antStartServer" classname="org.apache.catalina.ant.StartTask" />
<taskdef name="antStopServer" classname="org.apache.catalina.ant.StopTask" />但是当我运行脚本时,我得到了错误:
taskdef class org.apache.catalina.ant.StartTask cannot be found using the classloader AntClassLoader[]你能告诉我我哪里做错了吗?我把所有的jars都放到了Tomcat lib文件夹中。我使用的是Tomcat 9和Ant 1.10.5
发布于 2019-01-31 03:05:07
您需要指定一个类路径,Ant可以在其中找到您需要的类:
<!-- set the path to Tomcat root install directory -->
<property name="tomcat.home" value="..."/>
<path id="tomcat.path">
<fileset dir="${tomcat.home}/lib" includes="*.jar"/>
</path>
<taskdef name="antStartServer" classname="org.apache.catalina.ant.StartTask" classpathref="tomcat.path"/>
<taskdef name="antStopServer" classname="org.apache.catalina.ant.StopTask" classpathref="tomcat.path"/>https://stackoverflow.com/questions/54420209
复制相似问题