Tomcat task calls in ant (including deploy, undeploy, load, start, stop, etc)

Source: Internet
Author: User
Tomcat tasks require the Administrator's username and password.

Add in the tomcat-users.xml<UserUsername= "Admin"Password= "Admin"Roles= "Admin, Manager"/>

A row indicates creating an admin user. Its role is admin and manager.

Attributes in the following 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

Import the Tomcat task property file: < Taskdef File = "Tomcattasks. properties" >
< Classpath >
< Pathelement Path = & Quot; $ {tomcat. Home}/Server/lib/catalina-ant.jar & quot" />
</ Classpath >
</ Taskdef >

Reference install in tomcattasks. properties to call org. Apache. Catalina. Ant. Deploy (deploy deployment) < 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 >

Remove an application from Tomcat Program That is, org. Apache. Catalina. Ant. undeploy is called. < 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 and list tasks are similar.

< 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 >
Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.