我想将刚刚创建的*.war
(爆炸的)部署到${TOMCAT_HOME}/webapps
使用ant
目标。
配置
我的 tomcat 版本是 7.0.37 并且tomcat-users.xml
是:
<role rolename="tomcat"/>
<role rolename="role1"/>
<role rolename="manager-gui"/>
<user username="tomcat" password="tomcat" roles="tomcat,manager-gui"/>
<user username="both" password="tomcat" roles="tomcat,role1,manager-gui"/>
<user username="role1" password="tomcat" roles="role1"/>
war.properties
是 :
# War Build Properties
package.dir=${basedir}/package
war.exploded.dir=${deploy.dir}/war-ex
# --------- Tomcat Settings ---------------
# FIXME : tomcat.url=http://localhost:8080/manager/text
tomcat.url=http://localhost:8080/manager
tomcat.username=tomcat
tomcat.password=tomcat
context-path=/eccount
我的deploy-war
目标如下(tomcat-deploy.xml
):
<taskdef name="catalina-deploy" classname="org.apache.catalina.ant.DeployTask" classpathref="catalina.lib.classpath"/>
<target name="deploy-war" depends="build-wardir" description="Install web app">
<catalina-deploy url="${tomcat.url}"
username="${tomcat.username}"
password="${tomcat.password}"
path="${context-path}"
localwar="file://${war.exploded.dir}"/>
</target>
问题
当我ant deploy-war
通过命令行点击时,我得到以下异常:
FileNotFoundException : http://localhost:8080/manager/deploy?path=%2Feccount&war=file%3A%2F%2FC%3A%5Ceccount%2Fdeploy%2Fwar-ex
但是,file:///C:/eccount/deploy/war-ex
可以通过网络浏览器访问相同的路径。