Maven automatically deploys war (project) to Tomcat

Source: Internet
Author: User

1. Software Version

Apache -- tomcat-7.0.55

Apache-maven-3.2.2

Eclipse-standard-luna-R-win32-x86_64


2. Modify the file

2.1 Tomcat tomcat-users.xml

Add the following User Role Manager-script:

  • Manager-script-Access to the tools-friendly plain text interface that is described in this document, and to the "server status" page.


  <role rolename="manager-script"/>  <role rolename="manager-gui"/>  <role rolename="admin-gui"/>  <user username="admin" password="admin" roles="manager-script"/>

References

Http: // 127.0.0.1: 8080/docs/manager-howto.html # configuring_manager_application_access

2.2 Maven setting. xml

Add in servers

    <server>      <id>tomcat7</id>      <username>admin</username>      <password>admin</password>    </server>


2.3 project Pom. xml

<plugin><groupId>org.apache.tomcat.maven</groupId><artifactId>tomcat7-maven-plugin</artifactId><version>2.0-beta-1</version><configuration><url>http://localhost:8080/manager/text</url><server>tomcat7</server><username>admin</username><password>admin</password></configuration></plugin>

Note: The tomcat7 in the server here must be consistent with the server ID in the setting. xml file of the maven configuration file of the previous 2.2.


Maven command: tomcat7: deploy

For example

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.