我在ANT脚本下面启动/停止tomcat:
<project name="sample">
<property name="name" value="sample"/>
<path id="catalina-ant-classpath">
<fileset dir="D:\apache-tomcat-7.0.47-windows-x64\apache-tomcat-7.0.47\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/manager"
username="uname"
password="pwd"/>
</target>
<target name="stop" description="Stop Tomcat application">
<stop url="http://localhost:8080/manager"
username="uname"
password="pwd"/>
</target>
</project>
当我在脚本上面运行它会抛出以下错误:
D:\apache-ant-1.9.3-bin\apache-ant-1.9.3\bin>ant build.xml stop Buildfile: D:\apache-ant-1.9.3-bin\apache-ant-1.9.3\bin\build.xml BUILD FAILED Target "build.xml" does not exist in the project "sample".
上面的脚本有什么问题吗?
谢谢!
1 回答
您的build.xml缺少根元素
<project>
. 请参阅ant文档 .删除它是可选的
name
属性 .