ant目标将战争部署到tomcat7 / webapps [英] ant target to deploy war to tomcat7/webapps

查看:233
本文介绍了ant目标将战争部署到tomcat7 / webapps的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想将刚创建的 * .war (爆炸)部署到 $ {TOMCAT_HOME} / webapps 使用 ant target。

I want to deploy the just created *.war (exploded) to ${TOMCAT_HOME}/webapps using ant target.

我的tomcat版本是7.0.37和 tomcat-users.xml 是:

My tomcat version is 7.0.37 and tomcat-users.xml is :

  <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 通过命令行,我得到以下异常:

PROBLEM

When I hit ant deploy-war via command line , I get the following exception :

FileNotFoundException : http://localhost:8080/manager/deploy?path=%2Feccount&war=file%3A%2F%2FC%3A%5Ceccount%2Fdeploy%2Fwar-ex

但是,相同的路径 file:/// C:/ eccount / deploy / war-ex 是可以通过网络浏览器访问。

But, the same path file:///C:/eccount/deploy/war-ex is accesible via web browser.

在Tomcat 7.0.37中远程部署新应用程序

在Tomcat上部署war文件

Apache Ant如何将.war文件部署到Tomcat

用于Tomcat 7的Catalina-Ant

推荐答案

嗯,问题已解决:

 tomcat.url=http://localhost:8080/manager/text



第2步:向用户添加额外角色



STEP 2 : add extra role to user

  <role rolename="manager-script"/>

  <user username="tomcat" password="tomcat" roles="tomcat,manager-gui,manager-script"/>

感谢 Ant Tomcat 7重新加载FileNotFoundException

这篇关于ant目标将战争部署到tomcat7 / webapps的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆