MAVEN automatically deploys Web projects to TOMCAT8 (backwards compatible 7)

Source: Internet
Author: User

After the website is online, in order to ensure the continuity of the site operation, there is a new feature update, you can not restart the Tomcat server to deploy new features. Therefore, the research on

investigate use MAVEN's automatic deployment feature.


1 First make sure your computer has a Tomcat server installed

Go to the Tomcat installation directory and open: \conf\tomcat-users.xml, include the following in this configuration file:

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


of course user name and password I can write it. not the same, but two roles must be configured, and if there is no Manager-gui, the Tomcat program cannot be managed by a browser.

You can't upload a war package to a server without manager-script manage . .


2 The Pom.xml configuration of the Web project needs to download the jar packages and plugins

  <properties> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> < Project.deploy>deploy</project.deploy> <project.tomcat.version>8.0.0-rc5</ project.tomcat.version> </properties> <dependencies> <dependency> <gr              Oupid>org.apache.tomcat</groupid> <artifactId>tomcat-servlet-api</artifactId> <version>${project.tomcat.version}</version> <scope>provided</scope> <                  /dependency> </dependencies> <build> <plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> &LT;ARTIFACTID&GT;MAVEN-COMPILER-PLUGIN&L                      T;/artifactid> <version>3.1</version> <configuration>     <source>1.7</source>                 <target>1.7</target> </configuration> </plugin> <span style= "White-space:pre" ></span> <plugin> <groupid>org.apache.tomcat.ma Ven</groupid> <artifactId>tomcat7-maven-plugin</artifactId> <versio N>2.2</version> <configuration> <url>http://localhost:8080/mana Ger/text</url> <username>username</username> <password>p Assword</password> <path>/${project.artifactId}</path> </config   uration> </plugin> </plugins> </build>


3 start Tomcat8, and switch to the project directory via the CD command in the CMD window

Input MVN Tomcat7:deploy

Here we need to explain why it is not tomcat8 but TOMCAT7, because the MAVEN command does not support TOMCAT8, and the input tomcat7 here is actually

Perform the means of deploying the Web program to the Tomcat server.

At this point, the configuration is complete, you can incrementally release new features to the system.

MAVEN automatically deploys Web projects to TOMCAT8 (backwards compatible 7)

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.