ant中 Tomcat的任务调用(包括deploy,undeploy,load,start,stop等)

tomcat的任务需要管理者的用户名和密码

即在tomcat-users.xml加入
None.gif    < user  username ="admin"  password ="admin"  roles ="admin,manager" />
None.gif

一行,表明创建一个admin用户,它的角色是admin,manager

以下tomcat中的属性定性:(tomcatTasks.properties)
None.gif deploy=org.apache.catalina.ant.DeployTask
None.gifundeploy=org.apache.catalina.ant.UndeployTask
None.gifremove=org.apache.catalina.ant.RemoveTask
None.gifreload=org.apache.catalina.ant.ReloadTask
None.gifstart=org.apache.catalina.ant.StartTask
None.gifstop=org.apache.catalina.ant.StopTask
None.giflist=org.apache.catalina.ant.ListTask

引入tomcat的任务属性文件:
None.gif < taskdef  file ="tomcatTasks.properties" >
None.gif        
< classpath >
None.gif            
< pathelement  path ="${tomcat.home}/server/lib/catalina-ant.jar" />
None.gif        
</ classpath >
None.gif    
</ taskdef >


引用tomcatTasks.properties中install,即调用 org.apache.catalina.ant.deploy(deploy布署)
None.gif < target  name ="install"  description ="Install application in Tomcat"
None.gif        depends
="war" >
None.gif        
< deploy  url ="${tomcat.manager.url}"
None.gif            username
="${tomcat.manager.username}"
None.gif            password
="${tomcat.manager.password}"
None.gif            path
="/${webapp.name}"
None.gif            war
="file:${dist.dir}/${webapp.name}.war" />
None.gif    
</ target >

移除tomcat中的应用程序,即调用 org.apache.catalina.ant.undeploy
None.gif < target  name ="remove"  description ="Remove application from Tomcat" >
None.gif        
< undeploy  url ="${tomcat.manager.url}"
None.gif            username
="${tomcat.manager.username}"
None.gif            password
="${tomcat.manager.password}"
None.gif            path
="/${webapp.name}" />
None.gif    
</ target >


reload,start,stop和list任务也相似
 

None.gif    < target  name ="reload"  description ="Reload application in Tomcat" >
None.gif        
< reload  url ="${tomcat.manager.url}"
None.gif            username
="${tomcat.manager.username}"
None.gif            password
="${tomcat.manager.password}"
None.gif            path
="/${webapp.name}" />
None.gif    
</ target >
None.gif
None.gif    
< target  name ="start"  description ="Start Tomcat application" >
None.gif        
< start  url ="${tomcat.manager.url}"
None.gif            username
="${tomcat.manager.username}"
None.gif            password
="${tomcat.manager.password}"
None.gif            path
="/${webapp.name}" />
None.gif    
</ target >
None.gif
None.gif    
< target  name ="stop"  description ="Stop Tomcat application" >
None.gif        
< stop  url ="${tomcat.manager.url}"
None.gif            username
="${tomcat.manager.username}"
None.gif            password
="${tomcat.manager.password}"
None.gif            path
="/${webapp.name}" />
None.gif    
</ target >
None.gif
None.gif    
< target  name ="list"  description ="List Tomcat applications" >
None.gif        
< list  url ="${tomcat.manager.url}"
None.gif            username
="${tomcat.manager.username}"
None.gif            password
="${tomcat.manager.password}" />
None.gif    
</ target >
None.gif

转载于:https://www.cnblogs.com/fjchenq/archive/2007/05/28/762674.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值