创建项目
创建项目
导入
servlet
依赖到pom.xml文件
-
打开maven中央仓库地址:maven中央仓库,copy依赖
-
直接拷贝我的代码亦可
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
<version>3.0.1</version>
<scope>provided</scope>
</dependency>
项目测试
jetty
环境测试
<plugin>
<groupId>org.mortbay.jetty</groupId>
<artifactId>jetty-maven-plugin</artifactId>
<version>8.1.16.v20140903</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>run</goal>
</goals>
</execution>
</executions>
</plugin>
Tomcat
环境测试
<plugin>
<groupId>org.apache.tomcat.maven</groupId>
<artifactId>tomcat6-maven-plugin</artifactId>
<version>2.2</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>run</goal>
</goals>
</execution>
</executions>
</plugin>
本文小结
- 本人水平不足,文章中如有错误,敬请指正,谢谢!
- 本文借鉴了许多优秀的文章(在此表示感谢!)。