Deploy Web Apps to tomcat with Maven

Source: Internet
Author: User

1. Open the Tomcat Manager feature in the Tomcat-users.xml folder

 1  <  role  rolename  = "Manager-gui"  />  2   rolename  = "Manager-script"  />  3   username  = "Tomcat"   password  = "Tomcat"   roles  = "Manager-gui,manager-script"  />  

2. Add in Pom.xml

1  <Build>2         <Finalname>ROOT</Finalname>3         <Plugins>4             <plugin>5                 <groupId>Org.codehaus.mojo</groupId>6                 <Artifactid>Tomcat-maven-plugin</Artifactid>7                 <Configuration>8                     <URL>Http://www.test.com:8080/manager</URL>9                     <Server>Test</Server>Ten                     <Path>/</Path> One                 </Configuration> A             </plugin> -         </Plugins> -     </Build>
View Code

Finalname is set to root here, so the MVN package generates a war file named Root.war, which actually doesn't matter what the name is.

The URL of the Tomcat manager that published the app is configured here, and the app is deployed to the root/bottom. However, the user name and password are not configured, and this is related to <server>test</server>. Here, the user name and password are configured in other external files, to avoid changes in different environments pom.xml.

3. Setting.xml under Maven

1 <?XML version= "1.0" encoding= "UTF-8"?>2 <Settings>3     <Servers>4         <Server>5             <ID>Test</ID>6             <username>Tomcat</username>7             <Password>123456</Password>8         </Server>9     </Servers>Ten </Settings>
View Code

4. Running

MVN Tomcat:deploy or

MVN Tomcat:redeploy

Deploy Web Apps to tomcat with Maven

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.