zoukankan      html  css  js  c++  java
  • ant中 Tomcat的任务调用(包括deploy,undeploy,load,start,stop等)

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

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

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

    以下tomcat中的属性定性:(tomcatTasks.properties)
    deploy=org.apache.catalina.ant.DeployTask
    undeploy=org.apache.catalina.ant.UndeployTask
    remove=org.apache.catalina.ant.RemoveTask
    reload=org.apache.catalina.ant.ReloadTask
    start=org.apache.catalina.ant.StartTask
    stop=org.apache.catalina.ant.StopTask
    list=org.apache.catalina.ant.ListTask

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


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

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


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

      <target name="reload" description="Reload application in Tomcat">
            
    <reload url="${tomcat.manager.url}"
                username
    ="${tomcat.manager.username}"
                password
    ="${tomcat.manager.password}"
                path
    ="/${webapp.name}"/>
        
    </target>

        
    <target name="start" description="Start Tomcat application">
            
    <start url="${tomcat.manager.url}"
                username
    ="${tomcat.manager.username}"
                password
    ="${tomcat.manager.password}"
                path
    ="/${webapp.name}"/>
        
    </target>

        
    <target name="stop" description="Stop Tomcat application">
            
    <stop url="${tomcat.manager.url}"
                username
    ="${tomcat.manager.username}"
                password
    ="${tomcat.manager.password}"
                path
    ="/${webapp.name}"/>
        
    </target>

        
    <target name="list" description="List Tomcat applications">
            
    <list url="${tomcat.manager.url}"
                username
    ="${tomcat.manager.username}"
                password
    ="${tomcat.manager.password}"/>
        
    </target>
  • 相关阅读:
    使用PHP模拟post提交数据
    window.event.keycode值大全
    php采集
    自己写的一个简单PHP采集器
    php如何实现定时任务,php定时任务方法,最佳解决方案,php自动任务处理
    关于delphi软件运行出现Invalid floating point operation的错误的解决办法
    delphi编程创建桌面快捷方式
    BCB直接访问硬件端口和物理内存
    delphi winio 输入
    总是说spring难学?来看完这些spring的注解及其解释,真香!
  • 原文地址:https://www.cnblogs.com/fjchenq/p/762674.html
Copyright © 2011-2022 走看看