1.创建maven webapp项目
2.pom文件添加依赖及tomcat7-maven-plugin插件
<dependencies> <dependency> <groupId>javax.servlet</groupId> <artifactId>javax.servlet-api</artifactId> <version>3.0.1</version> <scope>provided</scope> </dependency> </dependencies> <build> <plugins> <plugin> <groupId>org.apache.tomcat.maven</groupId> <artifactId>tomcat7-maven-plugin</artifactId> <configuration> <port>8080</port> <path>/mywebdemo</path> <uriEncoding>UTF-8</uriEncoding> </configuration> </plugin> </plugins> </build>
3.注意事项 tomcat7支持的javax.servlet-api 最高版本为3.0x
4.启动