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> <ARTIFACTID>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)