Maven deploys web apps directly to Tomcat

Source: Internet
Author: User

1. Download the unzipped version of Tomcat and configure the environment variables to enable Tomcat to start successfully.

Using the unzipped version of Tomcat makes it easy to see the error messages of Tomcat's background output for easy debugging.

2. Configure the user name password for tomcat.

Modify the/config/tomcat-user.xml in the Tomcat installation directory to read as follows:

<?xml version= ' 1.0 ' encoding= ' cp936 '?  <tomcat-users ;  <role  rolename  =< Span class= "Hljs-value" > "Manager-gui" />  < Role  rolename  = "Manager-script" />  <user  username  = "username"  password  =  "password"  roles  = "Manager-gui,manager-script" />  </tomcat-users ;   

The purpose of the above configuration file is to add a user named "username" to tomcat with a password of "password" and a permission of "Manager-gui".

3. Add the following code to the MAVEN project's pom.xml.
<plugins>        <plugin>            <groupId>Org.apache.maven.plugins</groupId>            <artifactid>Maven-compiler-plugin</artifactid>            <version>2.3.2</version>            <configuration>                <source>1.7</Source>                <target>1.7</target>            </configuration>        </plugin>        <plugin>              <groupId>Org.apache.tomcat.maven</groupId>              <artifactid>Tomcat7-maven-plugin</artifactid>              <version>2.2</version>              <configuration>                  <URL>Http://localhost:8080/manager/text</URL>                  <username>Username</username>                  <password>Password</password>                  <path>/${project.artifactid}</path>              </configuration>          </plugin>     </plugins>
4. Deploy the App

If you use Eclipse, right-click Project->run as->maven build...-> enter tomcat7:deploy in goals;
If you are using MAVEN directly, execute the command:

mvntomcat7:deploy

Maven deploys web apps directly to Tomcat

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.