MAVEN implements direct deployment of Web projects to TOMCAT7

Source: Internet
Author: User

Reprinted from: http://my.oschina.net/angel243/blog/178554

I used to use maven very little in my project, and recently I learned about Maven, which is really a very powerful project building tool, for the definition and version of dependent packages, and for centralized management of dependencies (central warehouse). (Forgive my fuss, though Maven came out for a long time, but the younger brother just contacted), However, when developing a Web project, it is necessary to manually deploy to the Web server (TOMCAT7), if it can be automatically deployed to the Web server, instead of having to manually copy the target compiled war package to tomcat every time.

Here are the specific ways to use it:

1, TOMCAT7 Users and Permissions configuration: In the Conf directory, find Tomcat-users.xml, add Manager permissions of the user. Here I have used the permissions are added to the Admin user, the specific code is as follows:

<rolerolename= "Admin-gui"/><rolerolename= "Admin-script"/><rolerolename= "Manager-gui"/><rolerolename= "Manager-script"/><rolerolename= "MANAGER-JMX"/><rolerolename= "Manager-status"/><Userusername= "Admin"Password= "Password"Roles= "Manager-gui,manager-script,manager-jmx,manager-status,admin-script,admin-gui"/>

2, MAVEN server configuration: In the MAVEN installation path to find the Conf directory Setting.xml file, in the <servers> node to add TOMCAT7 configuration of user information (ID can be arbitrarily filled out, However, username and password must be consistent with step 1):

<Server>    <ID>Tomcat7</ID>    <username>Admin</username>    <Password>Password</Password></Server>

3. In the <plugins> node of the Web project's Pom.xml file, add the TOMCAT7 maven plugin,

<plugin>    <groupId>Org.apache.tomcat.maven</groupId>    <Artifactid>Tomcat7-maven-plugin</Artifactid>    <version>2.1</version>    <Configuration>        <!--Note the URL here -        <URL>Http://localhost:8080/manager/text</URL>        <Server>Tomcat7</Server> <!--the name here must match the ID configured in Setting.xml -        <Path>/mavenproject</Path> <!--The name here is the project name -    </Configuration></plugin>

4, finally, only need to MVN Tomcat7:deploy (you must start the Tomcat server beforehand)

MAVEN implements direct deployment of Web projects to TOMCAT7 (RPM)

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.