1, the first add tomcat plug-in dependencies in pom.xml:
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<packaging>war</packaging>
<name>javawebtest</name>
<groupId>com.maven.javawebtest</groupId>
<artifactId>javawebtest</artifactId>
<version>1.0-SNAPSHOT</version>
<dependencies>
</dependencies>
<build>
<plugins>
<!-- tomcat插件控制 -->
<plugin><groupId>org.apache.tomcat.maven</groupId><artifactId>tomcat7-maven-plugin</artifactId><
version>2.2</version>
<configuration>
<port>
8000
</port>
<path>/</path>
</configuration>
</plugin>
</plugins>
</build>
</project>
Upon completion of the open we will find in the menu bar maven plugins which have a tomcat plugin:
We run double click to start the project:
Open your browser and visit: http: // localhost: 8000 /: