0
我需要啓動和停止使用Ant腳本的Tomcat服務器,但是我發現堆棧溢出腳本,但是當我使用它時,它會給出下面提到的錯誤。如何使用Ant腳本啓動和停止Tomcat服務器?
腳本和控制檯我收到消息如下提到:
<project name="sample">
<property name="name" value="sample"/>
<path id="catalina-ant-classpath">
<fileset dir="C:\Users\vivsharm\Downloads\apache-tomcat-7.0.64-windows-x64\apache-tomcat-7.0.64\lib">
<include name="catalina-ant.jar"/>
</fileset>
</path>
<taskdef name="start" classname="org.apache.catalina.ant.StartTask">
<classpath refid="catalina-ant-classpath"/>
</taskdef>
<taskdef name="stop" classname="org.apache.catalina.ant.StopTask">
<classpath refid="catalina-ant-classpath"/>
</taskdef>
<target name="start" description="Start Tomcat application">
<start url="http://localhost:8080/"
username="uname"
password="pwd"/>
</target>
<target name="stop" description="Stop Tomcat application">
<stop url="http://localhost:8080/"
username="uname"
password="pwd"/>
</target>
</project>
,我收到錯誤消息如下:
C:\StartAndStopTomcat>ant start
Buildfile: C:\StartAndStopTomcat\build.xml
start:
BUILD FAILED
C:\StartAndStopTomcat\build.xml:19: Must specify 'path' attribute
Total time: 0 seconds
C:\StartAndStopTomcat>ant stop
Buildfile: C:\StartAndStopTomcat\build.xml
stop:
BUILD FAILED
C:\StartAndStopTomcat\build.xml:24: Must specify 'path' attribute
Total time: 0 seconds
enter code here
C:\StartAndStopTomcat>